Skip to content

Commit

Permalink
refactor: remove unneeded nesting in test
Browse files Browse the repository at this point in the history
Looking at our other examples I don't know why they refer to `named library`, I
am going to leave them and quietly shut the door behind me.
  • Loading branch information
kanej committed Jun 11, 2024
1 parent fd34977 commit c3af9bf
Showing 1 changed file with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ import {
} from "../../../../src/internal/module";
import {
ContractAtFuture,
ContractCallFuture,
ContractDeploymentFuture,
LibraryDeploymentFuture,
EncodeFunctionCallFuture,
FutureType,
LibraryDeploymentFuture,
NamedArtifactContractAtFuture,
ContractCallFuture,
NamedArtifactContractDeploymentFuture,
NamedArtifactLibraryDeploymentFuture,
StaticCallFuture,
ReadEventArgumentFuture,
SendDataFuture,
EncodeFunctionCallFuture,
StaticCallFuture,
} from "../../../../src/types/module";
import {
exampleAccounts,
Expand Down Expand Up @@ -665,32 +665,30 @@ describe("buildInitializeMessageFor", () => {
describe("encode function call state", () => {
let message: EncodeFunctionCallExecutionStateInitializeMessage;

describe("named library", () => {
beforeEach(async () => {
message = (await buildInitializeMessageFor(
encodedCall,
exampleDeploymentState,
basicStrategy,
{},
mockDeploymentLoader,
exampleAccounts,
getDefaultSender(exampleAccounts)
)) as EncodeFunctionCallExecutionStateInitializeMessage;
});
beforeEach(async () => {
message = (await buildInitializeMessageFor(
encodedCall,
exampleDeploymentState,
basicStrategy,
{},
mockDeploymentLoader,
exampleAccounts,
getDefaultSender(exampleAccounts)
)) as EncodeFunctionCallExecutionStateInitializeMessage;
});

it("should build an initialize message", async () => {
assert.deepStrictEqual(message, {
type: JournalMessageType.ENCODE_FUNCTION_CALL_EXECUTION_STATE_INITIALIZE,
futureId: "MyModule:EncodeFunctionCall",
strategy: "basic",
strategyConfig: {},
dependencies: ["MyModule:AnotherContract", "MyModule:SafeMath"],
artifactId: "MyModule:AnotherContract",
functionName: "test",
args: [1n, "b", libraryAddress, { sub: "d" }],
result:
"0xd40c6f1500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000016200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000016400000000000000000000000000000000000000000000000000000000000000",
});
it("should build an initialize message", async () => {
assert.deepStrictEqual(message, {
type: JournalMessageType.ENCODE_FUNCTION_CALL_EXECUTION_STATE_INITIALIZE,
futureId: "MyModule:EncodeFunctionCall",
strategy: "basic",
strategyConfig: {},
dependencies: ["MyModule:AnotherContract", "MyModule:SafeMath"],
artifactId: "MyModule:AnotherContract",
functionName: "test",
args: [1n, "b", libraryAddress, { sub: "d" }],
result:
"0xd40c6f1500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000016200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000016400000000000000000000000000000000000000000000000000000000000000",
});
});
});
Expand Down

0 comments on commit c3af9bf

Please sign in to comment.