-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathcreateRerunSuggestion.test.ts
80 lines (72 loc) · 3.52 KB
/
createRerunSuggestion.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { describe, expect, it } from "vitest";
import { Options } from "../shared/types.js";
import { createRerunSuggestion } from "./createRerunSuggestion.js";
const options = {
access: "public",
author: "TestAuthor",
base: "everything",
createRepository: true,
description: "Test description.",
email: {
github: "[email protected]",
npm: "[email protected]",
},
excludeAllContributors: true,
excludeCompliance: true,
excludeLintJSDoc: true,
excludeLintJson: true,
excludeLintKnip: true,
excludeLintMd: false,
excludeLintPackageJson: true,
excludeLintPackages: false,
excludeLintPerfectionist: true,
excludeLintSpelling: false,
excludeLintYml: false,
excludeReleases: false,
excludeRenovate: undefined,
excludeTests: undefined,
funding: undefined,
logo: undefined,
mode: "create",
owner: "TestOwner",
repository: "test-repository",
skipGitHubApi: true,
skipInstall: true,
skipRemoval: true,
skipRestore: undefined,
skipUninstall: undefined,
title: "Test Title",
} satisfies Options;
describe("createRerunSuggestion", () => {
it("includes key-value pairs with mixed truthy and falsy values", () => {
const actual = createRerunSuggestion(options);
expect(actual).toMatchInlineSnapshot(
'"npx create-typescript-app --mode create --base everything --access public --author TestAuthor --create-repository true --description \\"Test description.\\" --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --mode create --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
);
});
it("includes stringified logo when it exists", () => {
const actual = createRerunSuggestion({
...options,
logo: {
alt: "Test alt.",
src: "test/src.png",
},
mode: "initialize",
});
expect(actual).toMatchInlineSnapshot(
'"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --create-repository true --description \\"Test description.\\" --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --logo test/src.png --logo-alt \\"Test alt.\\" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
);
});
it("includes exclusions when they exist", () => {
const actual = createRerunSuggestion({
...options,
excludeCompliance: true,
excludeLintMd: true,
excludeLintSpelling: true,
mode: "initialize",
});
expect(actual).toMatchInlineSnapshot(
'"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --create-repository true --description \\"Test description.\\" --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-md true --exclude-lint-package-json true --exclude-lint-perfectionist true --exclude-lint-spelling true --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
);
});
});