Skip to content

Commit

Permalink
test: add author assertions to remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbutt committed Feb 24, 2024
1 parent e5f78c8 commit e54e5f6
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 42 deletions.
37 changes: 30 additions & 7 deletions tests/c.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe("generator-norgate-av:c", () => {
assert.equal(result.generator.options.name, name);
assert.equal(result.generator.options.id, id);
assert.equal(result.generator.options.description, description);
// assert.equal(result.generator.options.author, author);
assert.equal(result.generator.options.author, author);
assert.equal(
result.generator.options.git,
process.env.CI ? false : git,
Expand All @@ -155,6 +155,7 @@ describe("generator-norgate-av:c", () => {
name: id,
displayName: name,
description,
author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -184,7 +185,7 @@ describe("generator-norgate-av:c", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${author}`,
);
});

Expand Down Expand Up @@ -226,6 +227,11 @@ describe("generator-norgate-av:c", () => {
".all-contributorsrc",
`"projectName": "${id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down Expand Up @@ -312,7 +318,7 @@ describe("generator-norgate-av:c", () => {
assert.equal(result.generator.options.name, destination);
assert.equal(result.generator.options.id, id);
assert.equal(result.generator.options.description, description);
// assert.equal(result.generator.options.author, author);
assert.equal(result.generator.options.author, author);
assert.equal(
result.generator.options.git,
process.env.CI ? false : git,
Expand All @@ -339,6 +345,7 @@ describe("generator-norgate-av:c", () => {
name: id,
displayName: destination,
description,
author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -368,7 +375,7 @@ describe("generator-norgate-av:c", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${author}`,
);
});

Expand Down Expand Up @@ -410,6 +417,11 @@ describe("generator-norgate-av:c", () => {
".all-contributorsrc",
`"projectName": "${id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down Expand Up @@ -465,10 +477,15 @@ describe("generator-norgate-av:c", () => {
result?.cleanup();
});

it("should assign the correct default values", () => {
it("should assign the correct default values", async () => {
assert.equal(result.generator.options.id, "test-project");
assert.equal(result.generator.options.description, "");
assert.equal(result.generator.options.author, "");

assert.equal(
result.generator.options.author,
(await result.generator.git.name()) || "",
);

assert.equal(result.generator.options.git, !process.env.CI);
assert.equal(result.generator.options.pkg, "pnpm");
assert.equal(
Expand All @@ -492,6 +509,7 @@ describe("generator-norgate-av:c", () => {
name: result.generator.options.id,
displayName: destination,
description: result.generator.options.description,
author: result.generator.options.author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -524,7 +542,7 @@ describe("generator-norgate-av:c", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${result.generator.options.author}`,
);
});

Expand Down Expand Up @@ -575,6 +593,11 @@ describe("generator-norgate-av:c", () => {
".all-contributorsrc",
`"projectName": "${result.generator.options.id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${result.generator.options.author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down
37 changes: 30 additions & 7 deletions tests/html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("generator-norgate-av:html", () => {
assert.equal(result.generator.options.name, name);
assert.equal(result.generator.options.id, id);
assert.equal(result.generator.options.description, description);
// assert.equal(result.generator.options.author, author);
assert.equal(result.generator.options.author, author);
assert.equal(
result.generator.options.git,
process.env.CI ? false : git,
Expand All @@ -162,6 +162,7 @@ describe("generator-norgate-av:html", () => {
name: id,
displayName: name,
description,
author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -195,7 +196,7 @@ describe("generator-norgate-av:html", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${author}`,
);
});

Expand Down Expand Up @@ -237,6 +238,11 @@ describe("generator-norgate-av:html", () => {
".all-contributorsrc",
`"projectName": "${id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down Expand Up @@ -323,7 +329,7 @@ describe("generator-norgate-av:html", () => {
assert.equal(result.generator.options.name, destination);
assert.equal(result.generator.options.id, id);
assert.equal(result.generator.options.description, description);
// assert.equal(result.generator.options.author, author);
assert.equal(result.generator.options.author, author);
assert.equal(
result.generator.options.git,
process.env.CI ? false : git,
Expand All @@ -350,6 +356,7 @@ describe("generator-norgate-av:html", () => {
name: id,
displayName: destination,
description,
author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -379,7 +386,7 @@ describe("generator-norgate-av:html", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${author}`,
);
});

Expand Down Expand Up @@ -421,6 +428,11 @@ describe("generator-norgate-av:html", () => {
".all-contributorsrc",
`"projectName": "${id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down Expand Up @@ -481,10 +493,15 @@ describe("generator-norgate-av:html", () => {
result?.cleanup();
});

it("should assign the correct default values", () => {
it("should assign the correct default values", async () => {
assert.equal(result.generator.options.id, "test-project");
assert.equal(result.generator.options.description, "");
assert.equal(result.generator.options.author, "");

assert.equal(
result.generator.options.author,
(await result.generator.git.name()) || "",
);

assert.equal(result.generator.options.git, !process.env.CI);
assert.equal(result.generator.options.pkg, "pnpm");
assert.equal(
Expand All @@ -508,6 +525,7 @@ describe("generator-norgate-av:html", () => {
name: result.generator.options.id,
displayName: destination,
description: result.generator.options.description,
author: result.generator.options.author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -540,7 +558,7 @@ describe("generator-norgate-av:html", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${result.generator.options.author}`,
);
});

Expand Down Expand Up @@ -591,6 +609,11 @@ describe("generator-norgate-av:html", () => {
".all-contributorsrc",
`"projectName": "${result.generator.options.id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${result.generator.options.author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down
37 changes: 30 additions & 7 deletions tests/javascript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe("generator-norgate-av:javascript", () => {
assert.equal(result.generator.options.name, name);
assert.equal(result.generator.options.id, id);
assert.equal(result.generator.options.description, description);
// assert.equal(result.generator.options.author, author);
assert.equal(result.generator.options.author, author);
assert.equal(
result.generator.options.git,
process.env.CI ? false : git,
Expand All @@ -167,6 +167,7 @@ describe("generator-norgate-av:javascript", () => {
name: id,
displayName: name,
description,
author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -200,7 +201,7 @@ describe("generator-norgate-av:javascript", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${author}`,
);
});

Expand Down Expand Up @@ -242,6 +243,11 @@ describe("generator-norgate-av:javascript", () => {
".all-contributorsrc",
`"projectName": "${id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down Expand Up @@ -328,7 +334,7 @@ describe("generator-norgate-av:javascript", () => {
assert.equal(result.generator.options.name, destination);
assert.equal(result.generator.options.id, id);
assert.equal(result.generator.options.description, description);
// assert.equal(result.generator.options.author, author);
assert.equal(result.generator.options.author, author);
assert.equal(
result.generator.options.git,
process.env.CI ? false : git,
Expand All @@ -355,6 +361,7 @@ describe("generator-norgate-av:javascript", () => {
name: id,
displayName: destination,
description,
author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -388,7 +395,7 @@ describe("generator-norgate-av:javascript", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${author}`,
);
});

Expand Down Expand Up @@ -430,6 +437,11 @@ describe("generator-norgate-av:javascript", () => {
".all-contributorsrc",
`"projectName": "${id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down Expand Up @@ -490,10 +502,15 @@ describe("generator-norgate-av:javascript", () => {
result?.cleanup();
});

it("should assign the correct default values", () => {
it("should assign the correct default values", async () => {
assert.equal(result.generator.options.id, "test-project");
assert.equal(result.generator.options.description, "");
assert.equal(result.generator.options.author, "");

assert.equal(
result.generator.options.author,
(await result.generator.git.name()) || "",
);

assert.equal(result.generator.options.git, !process.env.CI);
assert.equal(result.generator.options.pkg, "pnpm");
assert.equal(
Expand All @@ -517,6 +534,7 @@ describe("generator-norgate-av:javascript", () => {
name: result.generator.options.id,
displayName: destination,
description: result.generator.options.description,
author: result.generator.options.author,
engines: {
node: `>=${engine}`,
},
Expand Down Expand Up @@ -553,7 +571,7 @@ describe("generator-norgate-av:javascript", () => {
assert.fileContent("LICENSE", "The MIT License (MIT)");
assert.fileContent(
"LICENSE",
`Copyright (c) ${new Date().getFullYear()}`,
`Copyright (c) ${new Date().getFullYear()} ${result.generator.options.author}`,
);
});

Expand Down Expand Up @@ -604,6 +622,11 @@ describe("generator-norgate-av:javascript", () => {
".all-contributorsrc",
`"projectName": "${result.generator.options.id}"`,
);

assert.fileContent(
".all-contributorsrc",
`"projectOwner": "${result.generator.options.author}"`,
);
});

it("should create the correct husky git hooks", () => {
Expand Down
Loading

0 comments on commit e54e5f6

Please sign in to comment.