-
Notifications
You must be signed in to change notification settings - Fork 629
Add CLI tests #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+199
−19
Merged
Add CLI tests #56
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
410757e
Add constants
nachoiacovino d736d65
Add tests for release and deploy
nachoiacovino d90cba1
Add test for detect
nachoiacovino 38c537a
Cleanup
nachoiacovino c48d762
Merge branch 'main' into ni/cli-tests
nachoiacovino 65b538a
Add changeset
nachoiacovino 92b379a
Maybe they are not deterministic, weird
nachoiacovino c4c465d
Merge branch 'main' into ni/cli-tests
nachoiacovino eed6c21
Merge branch 'main' into ni/cli-tests
jnsdls 9c3ec08
Merge branch 'main' into ni/cli-tests
jnsdls b17d2cd
Move warning to constant
nachoiacovino 61cd8ff
Merge branch 'ni/cli-tests' of https://github.com/thirdweb-dev/js int…
nachoiacovino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add tests for release and deploy
- Loading branch information
commit d736d65b0e0d47f79baa3d6ea08eee307cfc8fab
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { prepareEnvironment } from "@gmrchk/cli-testing-library"; | ||
| import { copyFile } from "fs/promises"; | ||
| import { resolve } from "path"; | ||
|
|
||
| // this creates an app, can take some time that's fine | ||
| jest.setTimeout(120_000); | ||
|
|
||
| describe("npx thirdweb deploy", () => { | ||
| it("should return deploy page url", async () => { | ||
| const { spawn, cleanup, exists, path } = await prepareEnvironment(); | ||
|
|
||
| await copyFile(resolve("./e2e/files/BasicContract.sol"), `${path}/BasicContract.sol`); | ||
|
|
||
| const { | ||
| waitForText, | ||
| waitForFinish, | ||
| getExitCode, | ||
| writeText, | ||
| getStdout, | ||
| } = await spawn("node", "./dist/cli/index.js deploy"); | ||
|
|
||
| expect(await exists("BasicContract.sol")).toEqual(true); | ||
|
|
||
| await waitForText("Failed to find a supported project configuration"); | ||
| await writeText("y") | ||
|
|
||
| // wait for program to finish | ||
| await waitForFinish(); | ||
|
|
||
| expect(getStdout().at(-1)).toEqual("https://thirdweb.com/contracts/deploy/QmTzUx1eZ1RAeEwsL85umbJFYMTwwu1UsAM3f3tWHSrHKF"); | ||
|
|
||
| // the process should exit with code 0 | ||
| expect(getExitCode()).toEqual(0); | ||
|
|
||
| await cleanup(); // cleanup after test | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| contract BasicContract { | ||
| constructor() {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { prepareEnvironment } from "@gmrchk/cli-testing-library"; | ||
| import { copyFile } from "fs/promises"; | ||
| import { resolve } from "path"; | ||
|
|
||
| // this creates an app, can take some time that's fine | ||
| jest.setTimeout(120_000); | ||
|
|
||
| describe("npx thirdweb release", () => { | ||
| it("should return release page url", async () => { | ||
| const { spawn, cleanup, exists, path } = await prepareEnvironment(); | ||
|
|
||
| await copyFile(resolve("./e2e/files/BasicContract.sol"), `${path}/BasicContract.sol`); | ||
|
|
||
| const { | ||
| waitForText, | ||
| waitForFinish, | ||
| getExitCode, | ||
| writeText, | ||
| getStdout, | ||
| } = await spawn("node", "./dist/cli/index.js release"); | ||
|
|
||
| expect(await exists("BasicContract.sol")).toEqual(true); | ||
|
|
||
| await waitForText("Failed to find a supported project configuration"); | ||
jnsdls marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| await writeText("y") | ||
|
|
||
| // wait for program to finish | ||
| await waitForFinish(); | ||
|
|
||
| expect(getStdout().at(-1)).toEqual("https://thirdweb.com/contracts/release/QmXENbPLE5wkAhyUr7y2YShsUHLTtgaG1CvQffUaek6pNN"); | ||
|
|
||
| // the process should exit with code 0 | ||
| expect(getExitCode()).toEqual(0); | ||
|
|
||
| await cleanup(); // cleanup after test | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.