Skip to content

Commit

Permalink
[ADHOC] refactor(sdk,tests): refactor testing api to support same api…
Browse files Browse the repository at this point in the history
… as non-test usage (#113)
  • Loading branch information
sammccord authored Sep 25, 2024
2 parents 2158d39 + 3d14854 commit f63a0fb
Show file tree
Hide file tree
Showing 16 changed files with 262 additions and 187 deletions.
5 changes: 1 addition & 4 deletions packages/sdk/src/Actions/Action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ export function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
return function cloneEventAction() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.EventAction(
defaultOptions,
basicErc721TransferAction(erc721),
),
fixtures.core.EventAction(basicErc721TransferAction(erc721)),
);
};
}
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/Actions/ContractAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function payableContractAction(fixtures: Fixtures, erc20: MockERC20) {
return function payableContractAction() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.ContractAction(defaultOptions, {
fixtures.core.ContractAction({
chainId: BigInt(31_337),
target: erc20.assertValidAddress(),
selector: mintPayableSelector,
Expand All @@ -52,7 +52,7 @@ function nonPayableAction(fixtures: Fixtures, erc20: MockERC20) {
return function nonPayableAction() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.ContractAction(defaultOptions, {
fixtures.core.ContractAction({
chainId: BigInt(31_337),
target: erc20.assertValidAddress(),
selector: mintSelector,
Expand All @@ -66,7 +66,7 @@ function otherAction(fixtures: Fixtures, erc20: MockERC20) {
return function nonPayableAction() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.ContractAction(defaultOptions, {
fixtures.core.ContractAction({
chainId: BigInt(31_337) + 1n,
target: erc20.assertValidAddress(),
selector: mintSelector,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/Actions/ERC721MintAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function nonPayableAction(fixtures: Fixtures, erc721: MockERC721) {
return function nonPayableAction() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.ERC721MintAction(defaultOptions, {
fixtures.core.ERC721MintAction({
chainId: BigInt(31_337),
target: erc721.assertValidAddress(),
selector: mintSelector,
Expand Down
5 changes: 1 addition & 4 deletions packages/sdk/src/Actions/EventAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
return function cloneEventAction() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.EventAction(
defaultOptions,
basicErc721TransferAction(erc721),
),
fixtures.core.EventAction(basicErc721TransferAction(erc721)),
);
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/AllowLists/AllowList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function freshAllowList(fixtures: Fixtures) {
return function freshAllowList() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.SimpleAllowList(defaultOptions, {
fixtures.core.SimpleAllowList({
owner: defaultOptions.account.address,
allowed: [defaultOptions.account.address],
}),
Expand All @@ -33,7 +33,7 @@ function freshDenyList(fixtures: Fixtures) {
return function freshDenyList() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.SimpleDenyList(defaultOptions, {
fixtures.core.SimpleDenyList({
owner: defaultOptions.account.address,
denied: [defaultOptions.account.address],
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/AllowLists/SimpleAllowList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function freshAllowList(fixtures: Fixtures) {
return function freshAllowList() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.SimpleAllowList(defaultOptions, {
fixtures.core.SimpleAllowList({
owner: defaultOptions.account.address,
allowed: [defaultOptions.account.address],
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/AllowLists/SimpleDenyList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function freshDenyList(fixtures: Fixtures) {
return function freshDenyList() {
return fixtures.registry.clone(
crypto.randomUUID(),
new fixtures.bases.SimpleDenyList(defaultOptions, {
fixtures.core.SimpleDenyList({
owner: defaultOptions.account.address,
denied: [defaultOptions.account.address],
}),
Expand Down
Loading

0 comments on commit f63a0fb

Please sign in to comment.