Skip to content

Commit 23fe8ac

Browse files
committed
refactor(examples): do not require explicit name/functionName for createTests
1 parent 2c00276 commit 23fe8ac

File tree

82 files changed

+98
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+98
-277
lines changed

packages/aws-durable-execution-sdk-js-examples/src/examples/block-example/block-example.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { OperationType } from "@aws/durable-execution-sdk-js-testing";
22
import { handler } from "./block-example";
3-
import historyEvents from "./block-example.history.json";
43
import { createTests } from "../../utils/test-helper";
54

65
createTests({
7-
name: "block-example test",
8-
functionName: "block-example",
96
handler,
107
tests: (runner, { assertEventSignatures }) => {
118
it("should execute nested child contexts with proper checkpointing", async () => {
@@ -54,7 +51,7 @@ createTests({
5451
);
5552
expect(waitOp).toBeDefined();
5653

57-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
54+
assertEventSignatures(execution);
5855
});
5956
},
6057
});

packages/aws-durable-execution-sdk-js-examples/src/examples/comprehensive-operations/comprehensive-operations.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { handler } from "./comprehensive-operations";
2-
import historyEvents from "./comprehensive-operations.history.json";
32
import { createTests } from "../../utils/test-helper";
43

54
createTests({
6-
name: "comprehensive-operations test",
7-
functionName: "comprehensive-operations",
85
handler,
96
tests: (runner, { assertEventSignatures }) => {
107
it("should execute all operations successfully", async () => {
@@ -95,7 +92,7 @@ createTests({
9592
expect(execution.getResult()).toBeDefined();
9693
expect(execution.getOperations().length).toBeGreaterThan(0);
9794

98-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
95+
assertEventSignatures(execution);
9996
});
10097
},
10198
});

packages/aws-durable-execution-sdk-js-examples/src/examples/concurrent/operations/concurrent-operations.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { handler } from "./concurrent-operations";
2-
import historyEvents from "./concurrent-operations.history.json";
32
import { createTests } from "../../../utils/test-helper";
43

54
createTests({
6-
name: "concurrent-operations test",
7-
functionName: "concurrent-operations",
85
localRunnerConfig: {
96
skipTime: false,
107
},
@@ -25,7 +22,7 @@ createTests({
2522
expect(block2.getContextDetails()?.result).toStrictEqual("task 2 result");
2623
expect(block2.getChildOperations()).toHaveLength(2);
2724

28-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
25+
assertEventSignatures(execution);
2926
}, 10000);
3027
},
3128
});

packages/aws-durable-execution-sdk-js-examples/src/examples/concurrent/wait/concurrent-wait.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { handler } from "./concurrent-wait";
2-
import historyEvents from "./concurrent-wait.history.json";
32
import { createTests } from "../../../utils/test-helper";
43

54
createTests({
6-
name: "concurrent-wait test",
7-
functionName: "concurrent-wait",
85
localRunnerConfig: {
96
skipTime: false,
107
},
@@ -24,7 +21,7 @@ createTests({
2421
expect(wait5SecondsOp.getWaitDetails()!.waitSeconds!).toBe(5);
2522
expect(wait10SecondsOp.getWaitDetails()!.waitSeconds!).toBe(10);
2623

27-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
24+
assertEventSignatures(execution);
2825
}, 30000);
2926
},
3027
});

packages/aws-durable-execution-sdk-js-examples/src/examples/context-validation/parent-context-in-child/parent-context-in-child.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { handler } from "./parent-context-in-child";
2-
import historyEvents from "./parent-context-in-child.history.json";
32
import { createTests } from "../../../utils/test-helper";
43

54
// Set shorter timeout for context validation tests since they should fail quickly
65
jest.setTimeout(5000);
76

87
createTests({
9-
name: "context validation - parent context in child error",
10-
functionName: "parent-context-in-child",
118
handler,
129
tests: (runner, { assertEventSignatures }) => {
1310
it("should fail when using parent context directly in child", async () => {
@@ -30,7 +27,7 @@ createTests({
3027
expect(operations[0].getName()).toBe("child-context");
3128
expect(operations[0].getStatus()).toBe("STARTED");
3229

33-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
30+
assertEventSignatures(execution);
3431
});
3532
},
3633
});

packages/aws-durable-execution-sdk-js-examples/src/examples/context-validation/parent-context-in-step/parent-context-in-step.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { handler } from "./parent-context-in-step";
2-
import historyEvents from "./parent-context-in-step.history.json";
32
import { createTests } from "../../../utils/test-helper";
43

54
// Set shorter timeout for context validation tests since they should fail quickly
65
jest.setTimeout(5000);
76

87
createTests({
9-
name: "context validation - parent context in step error",
10-
functionName: "parent-context-in-step",
118
handler,
129
tests: (runner, { assertEventSignatures }) => {
1310
it("should fail when using parent context inside step function", async () => {
@@ -76,7 +73,7 @@ createTests({
7673
expect(operations.length).toBeGreaterThanOrEqual(2);
7774
expect(operations.length).toBeLessThanOrEqual(3);
7875

79-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
76+
assertEventSignatures(execution);
8077
});
8178
},
8279
});

packages/aws-durable-execution-sdk-js-examples/src/examples/context-validation/parent-context-in-wait-condition/parent-context-in-wait-condition.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { handler } from "./parent-context-in-wait-condition";
2-
import historyEvents from "./parent-context-in-wait-condition.history.json";
32
import { createTests } from "../../../utils/test-helper";
43
import {
54
ExecutionStatus,
@@ -10,8 +9,6 @@ import {
109
jest.setTimeout(5000);
1110

1211
createTests({
13-
name: "context validation - parent context in wait condition error",
14-
functionName: "parent-context-in-wait-condition",
1512
handler,
1613
tests: (runner, { assertEventSignatures }) => {
1714
it("should fail when using parent context inside waitForCondition", async () => {
@@ -67,7 +64,7 @@ createTests({
6764
// Should have exactly 2 operations: child-context and wrong-wait-condition
6865
expect(operations.length).toBe(2);
6966

70-
assertEventSignatures(execution.getHistoryEvents(), historyEvents);
67+
assertEventSignatures(execution);
7168
});
7269
},
7370
});

packages/aws-durable-execution-sdk-js-examples/src/examples/create-callback/concurrent/create-callback-concurrent.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import { handler } from "./create-callback-concurrent";
77
import { createTests } from "../../../utils/test-helper";
88

99
createTests({
10-
name: "create-callback-concurrent test",
11-
functionName: "create-callback-concurrent",
1210
handler,
1311
invocationType: InvocationType.Event,
1412
tests: (runner) => {

packages/aws-durable-execution-sdk-js-examples/src/examples/create-callback/failures/create-callback-failures.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { handler } from "./create-callback-failures";
66
import { createTests } from "../../../utils/test-helper";
77

88
createTests({
9-
name: "create-callback-failures test",
10-
functionName: "create-callback-failures",
119
handler,
1210
invocationType: InvocationType.Event,
1311
tests: (runner) => {

packages/aws-durable-execution-sdk-js-examples/src/examples/create-callback/heartbeat/create-callback-heartbeat.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { createTests } from "../../../utils/test-helper";
33
import { InvocationType } from "@aws-sdk/client-lambda";
44

55
createTests({
6-
name: "create-callback-heartbeat test",
7-
functionName: "create-callback-heartbeat",
86
handler,
97
invocationType: InvocationType.Event,
108
tests: (runner, { isCloud }) => {

0 commit comments

Comments
 (0)