-
Notifications
You must be signed in to change notification settings - Fork 103
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
Adding automated anvil testing client creation. #324
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome discovery of how to get this to work, minor suggestions with naming and configuration
@@ -135,6 +135,10 @@ jobs: | |||
run: | | |||
npx turbo run build | |||
|
|||
- name: Test js package | |||
run: | | |||
npx turbo run test:js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
transport: http(anvilHost), | ||
}); | ||
|
||
await use({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great use of use
afterEach(() => testClient.reset()); | ||
|
||
it( | ||
anvilTest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about renaming to anvilRunningTest
"--fork-url", | ||
"https://rpc.zora.co/", | ||
"--fork-block-number", | ||
"6133407", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about allowing chain name (zora
, or zora-sepolia
) and blockNumber
to be specified as arguments with defaults?
from env vars or?
…On Fri, Nov 3, 2023 at 17:20 Dan Oved ***@***.***> wrote:
***@***.**** approved this pull request.
awesome discovery of how to get this to work, minor suggestions with
naming and configuration
------------------------------
In .github/workflows/foundry.yml
<#324 (comment)>
:
> @@ -135,6 +135,10 @@ jobs:
run: |
npx turbo run build
+ - name: Test js package
+ run: |
+ npx turbo run test:js
nice!
------------------------------
In packages/protocol-sdk/src/anvil.ts
<#324 (comment)>
:
> + chain,
+ transport: http(anvilHost),
+ });
+
+ const testClient = createTestClient({
+ chain,
+ mode: "anvil",
+ transport: http(anvilHost),
+ });
+
+ const publicClient = createPublicClient({
+ chain,
+ transport: http(anvilHost),
+ });
+
+ await use({
great use of use
------------------------------
In packages/protocol-sdk/src/create/1155-create-helper.test.ts
<#324 (comment)>
:
>
const demoTokenMetadataURI = "ipfs://DUMMY/token.json";
const demoContractMetadataURI = "ipfs://DUMMY/contract.json";
describe("create-helper", () => {
- beforeEach(async () => {
- await testClient.setBalance({
- address: creatorAccount,
- value: parseEther("1"),
- });
- });
- afterEach(() => testClient.reset());
-
- it(
+ anvilTest(
how about renaming to anvilRunningTest
------------------------------
In packages/protocol-sdk/src/anvil.ts
<#324 (comment)>
:
> + });
+}
+
+export const anvilTest = test.extend<AnvilViemClientsTest>({
+ viemClients: async ({task}, use) => {
+ console.log('setting up clients for ', task.name);
+ const port = Math.floor(Math.random() * 2000) + 4000;
+ const anvil = spawn(
+ "anvil",
+ [
+ "--port",
+ `${port}`,
+ "--fork-url",
+ "https://rpc.zora.co/",
+ "--fork-block-number",
+ "6133407",
how about allowing chain name (zora, or zora-sepolia) and blockNumber to
be specified as arguments with defaults?
—
Reply to this email directly, view it on GitHub
<#324 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGMCODM5IWX5U2K7ECKSETYCVN23AVCNFSM6AAAAAA635YKDGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMJTGU2DENZRGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
i would say for each test, to be able to config via json the fork chain name (or rpc url) and fork block # |
Adding automated anvil test running using vitest for premint sdk testing.