Skip to content

Commit 9930336

Browse files
committed
fix broken tests
1 parent fbde6bf commit 9930336

File tree

3 files changed

+291
-301
lines changed

3 files changed

+291
-301
lines changed

packages/aws-durable-execution-sdk-js-examples/scripts/generate-sam-template.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ const EXAMPLE_CONFIGS = {
1717
},
1818
],
1919
},
20-
"wait-for-callback-submitter-retry-success": {
21-
memorySize: 128,
22-
timeout: 120,
23-
policies: [],
24-
},
2520
};
2621

2722
// Default configuration for Lambda functions

packages/aws-durable-execution-sdk-js-examples/src/__tests__/generate-sam-template.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const {
44
createFunctionResource,
55
generateTemplate,
66
} = require("../../scripts/generate-sam-template.js");
7+
const catalog = require("../utils/examples-catalog.json");
78

89
describe("generate-sam-template", () => {
910
describe("toPascalCase", () => {
@@ -17,10 +18,15 @@ describe("generate-sam-template", () => {
1718

1819
describe("createFunctionResource", () => {
1920
test("creates default function resource", () => {
20-
const resource = createFunctionResource("hello-world");
21+
const resource = createFunctionResource(
22+
"hello-world",
23+
catalog.find(({ handler }: { handler: string }) => {
24+
return handler === "hello-world.handler";
25+
}),
26+
);
2127

2228
expect(resource.Type).toBe("AWS::Serverless::Function");
23-
expect(resource.Properties.FunctionName).toBe("HelloWorld-TypeScript");
29+
expect(resource.Properties.FunctionName).toBe("hello-world");
2430
expect(resource.Properties.Handler).toBe("hello-world.handler");
2531
expect(resource.Properties.Runtime).toBe("nodejs22.x");
2632
expect(resource.Properties.MemorySize).toBe(128);
@@ -29,11 +35,14 @@ describe("generate-sam-template", () => {
2935
});
3036

3137
test("creates function resource with custom config for steps-with-retry", () => {
32-
const resource = createFunctionResource("steps-with-retry", {});
33-
34-
expect(resource.Properties.FunctionName).toBe(
35-
"StepsWithRetry-TypeScript",
38+
const resource = createFunctionResource(
39+
"steps-with-retry",
40+
catalog.find(({ handler }: { handler: string }) => {
41+
return handler === "steps-with-retry.handler";
42+
}),
3643
);
44+
45+
expect(resource.Properties.FunctionName).toBe("steps-with-retry");
3746
expect(resource.Properties.MemorySize).toBe(256);
3847
expect(resource.Properties.Timeout).toBe(300);
3948
expect(resource.Properties.Policies).toEqual([
@@ -48,15 +57,6 @@ describe("generate-sam-template", () => {
4857
test("includes required environment variables", () => {
4958
const resource = createFunctionResource("hello-world", {});
5059

51-
expect(resource.Properties.Environment.Variables).toEqual({
52-
AWS_ENDPOINT_URL_LAMBDA: "http://host.docker.internal:5000",
53-
DURABLE_VERBOSE_MODE: "true",
54-
});
55-
});
56-
57-
test("disables verbose logging when skipVerboseLogging is true", () => {
58-
const resource = createFunctionResource("hello-world", {}, true);
59-
6060
expect(resource.Properties.Environment.Variables).toEqual({
6161
AWS_ENDPOINT_URL_LAMBDA: "http://host.docker.internal:5000",
6262
DURABLE_VERBOSE_MODE: "false",

0 commit comments

Comments
 (0)