Skip to content

Commit d235931

Browse files
committed
Address linter errors in validate.test.mts
1 parent b136352 commit d235931

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

pr-checks/changelog/validate.test.mts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ import {
1515
async function withTmpFile<T>(
1616
baseFileName: string,
1717
contents: string,
18-
body: (filePath: string) => Promise<T>,
18+
body: (filePath: string) => Promise<T> | T,
1919
): Promise<T> {
2020
const tmpDir = fs.mkdtempSync(
2121
path.join(os.tmpdir(), "changetool-validate-test-"),
2222
);
2323
try {
2424
const filePath = path.join(tmpDir, baseFileName);
2525
fs.writeFileSync(filePath, contents);
26-
return await body(filePath);
26+
return await Promise.resolve(body(filePath));
2727
} finally {
2828
fs.rmSync(tmpDir, { recursive: true, force: true });
2929
}
3030
}
3131

3232
await describe("isValidChangenoteContent", async () => {
33-
await it("recognizes an unordered Markdown list", async () => {
33+
await it("recognizes an unordered Markdown list", () => {
3434
const inputs = [
3535
"- One changenote entry",
3636
"- First item\n- Second item",
@@ -42,7 +42,7 @@ await describe("isValidChangenoteContent", async () => {
4242
}
4343
});
4444

45-
await it("does not recognize non-Markdown text", async () => {
45+
await it("does not recognize non-Markdown text", () => {
4646
const inputs = [
4747
"This is not a list.",
4848
'["this", "is", "JSON"]',
@@ -57,7 +57,7 @@ await describe("isValidChangenoteContent", async () => {
5757
}
5858
});
5959

60-
await it("does not recognize ordered Markdown lists", async () => {
60+
await it("does not recognize ordered Markdown lists", () => {
6161
const inputs = [
6262
"1. First item\n2. Second item",
6363
"\n\n\n1. First item\n1. Second item",
@@ -68,7 +68,7 @@ await describe("isValidChangenoteContent", async () => {
6868
}
6969
});
7070

71-
await it("requires all list items to use a hyphen bullet", async () => {
71+
await it("requires all list items to use a hyphen bullet", () => {
7272
const inputs = [
7373
"* Fixed a bug\n* Added feature",
7474
"+ Fixed a bug\n+ Added feature",
@@ -85,7 +85,7 @@ await describe("isValidChangenoteContent", async () => {
8585
}
8686
});
8787

88-
await it("does not contain other Markdown elements", async () => {
88+
await it("does not contain other Markdown elements", () => {
8989
const inputs = [
9090
"- Fixed a bug\n\nParagraph of text",
9191
"- Fixed a bug\n\n* Added a feature",
@@ -100,7 +100,7 @@ await describe("isValidChangenoteContent", async () => {
100100
});
101101

102102
await describe("isValidChangenoteFilename", async () => {
103-
await it("accepts valid filenames", async () => {
103+
await it("accepts valid filenames", () => {
104104
const inputs = [
105105
"2023-01-01-fix-bug.md",
106106
"2023-12-31-add-feature.md",
@@ -112,7 +112,7 @@ await describe("isValidChangenoteFilename", async () => {
112112
}
113113
});
114114

115-
await it("rejects invalid filenames", async () => {
115+
await it("rejects invalid filenames", () => {
116116
const inputs = [
117117
"missing-date-from-filename.md",
118118
"2021-01-01.md",
@@ -126,14 +126,14 @@ await describe("isValidChangenoteFilename", async () => {
126126
});
127127

128128
await describe("hasValidChangenoteCategory", async () => {
129-
await it("accepts valid categories", async () => {
129+
await it("accepts valid categories", () => {
130130
for (const category of Object.keys(VALID_CHANGE_NOTE_CATEGORIES)) {
131131
const frontmatter = { category };
132132
assert.equal(hasValidChangenoteCategory(frontmatter), true);
133133
}
134134
});
135135

136-
await it("rejects invalid categories", async () => {
136+
await it("rejects invalid categories", () => {
137137
const inputs = [
138138
"",
139139
"invalid-category",
@@ -150,7 +150,7 @@ await describe("hasValidChangenoteCategory", async () => {
150150
}
151151
});
152152

153-
await it("reject missing category", async () => {
153+
await it("reject missing category", () => {
154154
assert.equal(hasValidChangenoteCategory({}), false);
155155
assert.equal(hasValidChangenoteCategory({ category: null }), false);
156156
assert.equal(hasValidChangenoteCategory({ category: undefined }), false);
@@ -162,7 +162,7 @@ await describe("isValidChangenoteFile", async () => {
162162
await withTmpFile(
163163
"2026-01-01-fix-bug.md",
164164
"---\ncategory: fix\n---\n- Fixed a bug\n",
165-
async (filePath) => {
165+
(filePath) => {
166166
assert.equal(isValidChangenoteFile(filePath), true);
167167
},
168168
);
@@ -172,7 +172,7 @@ await describe("isValidChangenoteFile", async () => {
172172
await withTmpFile(
173173
"fix-bug.md",
174174
"---\ncategory: fix\n---\n- Fixed a bug\n",
175-
async (filePath) => {
175+
(filePath) => {
176176
assert.equal(isValidChangenoteFile(filePath), false);
177177
},
178178
);
@@ -182,7 +182,7 @@ await describe("isValidChangenoteFile", async () => {
182182
await withTmpFile(
183183
"2026-01-01-fix-bug.md",
184184
"- Fixed a bug\n",
185-
async (filePath) => {
185+
(filePath) => {
186186
assert.equal(isValidChangenoteFile(filePath), false);
187187
},
188188
);
@@ -192,7 +192,7 @@ await describe("isValidChangenoteFile", async () => {
192192
await withTmpFile(
193193
"2026-01-01-fix-bug.md",
194194
"---\ncategory: fix\n---\n* Fixed a bug\n",
195-
async (filePath) => {
195+
(filePath) => {
196196
assert.equal(isValidChangenoteFile(filePath), false);
197197
},
198198
);

0 commit comments

Comments
 (0)