Skip to content

Commit 1769f30

Browse files
committed
test: refine template variable hydration and update integration test descriptions
- Updated test case to clarify that overlapping template variables should not be hydrated implicitly. - Adjusted assertions to ensure that the expected behavior aligns with the new logic. - Enhanced integration helper functions to include a description field for better test clarity. - Updated snapshot tests to reflect changes in package.json descriptions and repository URLs for consistency.
1 parent b624e45 commit 1769f30

File tree

5 files changed

+21
-26
lines changed

5 files changed

+21
-26
lines changed

packages/create-gen-app-test/src/__tests__/__snapshots__/cached-template.test.ts.snap

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,29 @@ exports[`cached template integration tests first clone with variable replacement
1616
"package.json": {
1717
"author": "Test User test <[email protected]>",
1818
"bugs": {
19-
"url": "https://github.com/Test User test/Test User test/issues",
19+
"url": "https://github.com/tester-test/integration-test/issues",
2020
},
21-
"description": "Test Module test",
21+
"description": "Integration test module test",
2222
"devDependencies": {
23-
"pgsql-test": "^2.13.2",
23+
"makage": "0.1.8",
24+
"pgsql-test": "^2.14.12",
2425
},
25-
"homepage": "https://github.com/Test User test/Test User test",
26+
"homepage": "https://github.com/tester-test/integration-test",
2627
"keywords": [],
2728
"license": "MIT",
2829
"name": "integration-test",
29-
"pnpm": {
30-
"overrides": {
31-
"graphql": "14.7.0",
32-
},
33-
},
3430
"publishConfig": {
3531
"access": "public",
3632
"directory": "dist",
3733
},
3834
"repository": {
3935
"type": "git",
40-
"url": "https://github.com/Test User test/Test User test",
36+
"url": "https://github.com/tester-test/integration-test",
4137
},
4238
"scripts": {
4339
"lint": "eslint . --fix",
4440
"test": "jest",
45-
"test:watch": "jest --watch",
41+
"test:watch": "makage test --watch deploy --ext sql",
4642
},
4743
"version": "0.0.1",
4844
},
@@ -65,33 +61,29 @@ exports[`cached template integration tests second clone from cache should snapsh
6561
"package.json": {
6662
"author": "Test User cached <[email protected]>",
6763
"bugs": {
68-
"url": "https://github.com/Test User cached/Test User cached/issues",
64+
"url": "https://github.com/tester-cached/integration-cached/issues",
6965
},
70-
"description": "Test Module cached",
66+
"description": "Integration test module cached",
7167
"devDependencies": {
72-
"pgsql-test": "^2.13.2",
68+
"makage": "0.1.8",
69+
"pgsql-test": "^2.14.12",
7370
},
74-
"homepage": "https://github.com/Test User cached/Test User cached",
71+
"homepage": "https://github.com/tester-cached/integration-cached",
7572
"keywords": [],
7673
"license": "MIT",
7774
"name": "integration-cached",
78-
"pnpm": {
79-
"overrides": {
80-
"graphql": "14.7.0",
81-
},
82-
},
8375
"publishConfig": {
8476
"access": "public",
8577
"directory": "dist",
8678
},
8779
"repository": {
8880
"type": "git",
89-
"url": "https://github.com/Test User cached/Test User cached",
81+
"url": "https://github.com/tester-cached/integration-cached",
9082
},
9183
"scripts": {
9284
"lint": "eslint . --fix",
9385
"test": "jest",
94-
"test:watch": "jest --watch",
86+
"test:watch": "makage test --watch deploy --ext sql",
9587
},
9688
"version": "0.0.1",
9789
},

packages/create-gen-app-test/src/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ export async function runCli(
208208

209209
const answerOverrides = extractAnswerOverrides(args);
210210
const noTty = Boolean(
211-
args["no-tty"] ?? (args as Record<string, unknown>).noTty
211+
args["no-tty"] ??
212+
(args as Record<string, unknown>).noTty ??
213+
(args as Record<string, unknown>).tty === false
212214
);
213215

214216
// Use the createFromTemplate function which will use the same cache

packages/create-gen-app-test/src/test-utils/integration-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function buildAnswers(
3535
email: `tester-${safeSuffix}@example.com`,
3636
moduleName: `integration-${safeSuffix}`,
3737
moduleDesc: `Integration test module ${suffix}`,
38+
description: `Integration test module ${suffix}`,
3839
repoName: `integration-${safeSuffix}`,
3940
username: `tester-${safeSuffix}`,
4041
access: "public",
@@ -43,4 +44,3 @@ export function buildAnswers(
4344
...overrides,
4445
};
4546
}
46-

packages/create-gen-app/__tests__/create-gen.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ module.exports = {
378378
expect(answers.fullName).toBe("Prompted User");
379379
});
380380

381-
it("should hydrate overlapping template variables from answers", async () => {
381+
it("should not hydrate overlapping template variables implicitly", async () => {
382382
const { Inquirerer } = require("inquirerer");
383383
const mockPrompt = jest.fn().mockResolvedValue({
384384
description: "Prompted description",
@@ -406,7 +406,7 @@ module.exports = {
406406

407407
const answers = await promptUser(extractedVariables, {}, false);
408408
expect(answers.description).toBe("Prompted description");
409-
expect(answers.moduleDesc).toBe("Prompted description");
409+
expect(answers.moduleDesc).toBeUndefined();
410410
});
411411
});
412412

packages/create-gen-app/test-utils/integration-helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function buildAnswers(
3535
email: `tester-${safeSuffix}@example.com`,
3636
moduleName: `integration-${safeSuffix}`,
3737
moduleDesc: `Integration test module ${suffix}`,
38+
description: `Integration test module ${suffix}`,
3839
repoName: `integration-${safeSuffix}`,
3940
username: `tester-${safeSuffix}`,
4041
access: "public",

0 commit comments

Comments
 (0)