Skip to content

Commit 5bb75f2

Browse files
committed
test: no more need for test.serial
1 parent fd4a18e commit 5bb75f2

File tree

4 files changed

+1517
-1585
lines changed

4 files changed

+1517
-1585
lines changed

test/add-channel.test.js

Lines changed: 57 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.beforeEach((t) => {
1515
t.context.logger = { log: t.context.log, error: t.context.error };
1616
});
1717

18-
test.serial("Update a release", async (t) => {
18+
test("Update a release", async (t) => {
1919
const owner = "test_user";
2020
const repo = "test_repo";
2121
const env = { GITHUB_TOKEN: "github_token" };
@@ -76,7 +76,7 @@ test.serial("Update a release", async (t) => {
7676
t.true(fetch.done());
7777
});
7878

79-
test.serial("Update a maintenance release", async (t) => {
79+
test("Update a maintenance release", async (t) => {
8080
const owner = "test_user";
8181
const repo = "test_repo";
8282
const env = { GITHUB_TOKEN: "github_token" };
@@ -138,7 +138,7 @@ test.serial("Update a maintenance release", async (t) => {
138138
t.true(fetch.done());
139139
});
140140

141-
test.serial("Update a prerelease", async (t) => {
141+
test("Update a prerelease", async (t) => {
142142
const owner = "test_user";
143143
const repo = "test_repo";
144144
const env = { GITHUB_TOKEN: "github_token" };
@@ -199,7 +199,7 @@ test.serial("Update a prerelease", async (t) => {
199199
t.true(fetch.done());
200200
});
201201

202-
test.serial("Update a release with a custom github url", async (t) => {
202+
test("Update a release with a custom github url", async (t) => {
203203
const owner = "test_user";
204204
const repo = "test_repo";
205205
const env = {
@@ -264,7 +264,7 @@ test.serial("Update a release with a custom github url", async (t) => {
264264
t.true(fetch.done());
265265
});
266266

267-
test.serial("Create the new release if current one is missing", async (t) => {
267+
test("Create the new release if current one is missing", async (t) => {
268268
const owner = "test_user";
269269
const repo = "test_repo";
270270
const env = { GITHUB_TOKEN: "github_token" };
@@ -327,7 +327,7 @@ test.serial("Create the new release if current one is missing", async (t) => {
327327
t.true(fetch.done());
328328
});
329329

330-
test.serial("Throw error if cannot read current release", async (t) => {
330+
test("Throw error if cannot read current release", async (t) => {
331331
const owner = "test_user";
332332
const repo = "test_repo";
333333
const env = { GITHUB_TOKEN: "github_token" };
@@ -369,66 +369,59 @@ test.serial("Throw error if cannot read current release", async (t) => {
369369
t.true(fetch.done());
370370
});
371371

372-
test.serial(
373-
"Throw error if cannot create missing current release",
374-
async (t) => {
375-
const owner = "test_user";
376-
const repo = "test_repo";
377-
const env = { GITHUB_TOKEN: "github_token" };
378-
const pluginConfig = {};
379-
const nextRelease = {
380-
gitTag: "v1.0.0",
381-
name: "v1.0.0",
382-
notes: "Test release note body",
383-
};
384-
const options = {
385-
repositoryUrl: `https://github.com/${owner}/${repo}.git`,
386-
};
387-
388-
const fetch = fetchMock
389-
.sandbox()
390-
.getOnce(
391-
`https://api.github.local/repos/${owner}/${repo}/releases/tags/${nextRelease.gitTag}`,
392-
404
393-
)
394-
.postOnce(
395-
`https://api.github.local/repos/${owner}/${repo}/releases`,
396-
500,
397-
{
398-
body: {
399-
tag_name: nextRelease.gitTag,
400-
name: nextRelease.name,
401-
body: nextRelease.notes,
402-
prerelease: false,
403-
},
404-
}
405-
);
406-
407-
const error = await t.throwsAsync(
408-
addChannel(
409-
pluginConfig,
410-
{
411-
env,
412-
options,
413-
branch: { type: "release", main: true },
414-
nextRelease,
415-
logger: t.context.logger,
416-
},
417-
{
418-
Octokit: TestOctokit.defaults((options) => ({
419-
...options,
420-
request: { ...options.request, fetch },
421-
})),
422-
}
423-
)
424-
);
372+
test("Throw error if cannot create missing current release", async (t) => {
373+
const owner = "test_user";
374+
const repo = "test_repo";
375+
const env = { GITHUB_TOKEN: "github_token" };
376+
const pluginConfig = {};
377+
const nextRelease = {
378+
gitTag: "v1.0.0",
379+
name: "v1.0.0",
380+
notes: "Test release note body",
381+
};
382+
const options = {
383+
repositoryUrl: `https://github.com/${owner}/${repo}.git`,
384+
};
385+
386+
const fetch = fetchMock
387+
.sandbox()
388+
.getOnce(
389+
`https://api.github.local/repos/${owner}/${repo}/releases/tags/${nextRelease.gitTag}`,
390+
404
391+
)
392+
.postOnce(`https://api.github.local/repos/${owner}/${repo}/releases`, 500, {
393+
body: {
394+
tag_name: nextRelease.gitTag,
395+
name: nextRelease.name,
396+
body: nextRelease.notes,
397+
prerelease: false,
398+
},
399+
});
400+
401+
const error = await t.throwsAsync(
402+
addChannel(
403+
pluginConfig,
404+
{
405+
env,
406+
options,
407+
branch: { type: "release", main: true },
408+
nextRelease,
409+
logger: t.context.logger,
410+
},
411+
{
412+
Octokit: TestOctokit.defaults((options) => ({
413+
...options,
414+
request: { ...options.request, fetch },
415+
})),
416+
}
417+
)
418+
);
425419

426-
t.is(error.status, 500);
427-
t.true(fetch.done());
428-
}
429-
);
420+
t.is(error.status, 500);
421+
t.true(fetch.done());
422+
});
430423

431-
test.serial("Throw error if cannot update release", async (t) => {
424+
test("Throw error if cannot update release", async (t) => {
432425
const owner = "test_user";
433426
const repo = "test_repo";
434427
const env = { GITHUB_TOKEN: "github_token" };

test/find-sr-issue.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test.beforeEach((t) => {
1313
t.context.logger = { log: t.context.log, error: t.context.error };
1414
});
1515

16-
test.serial("Filter out issues without ID", async (t) => {
16+
test("Filter out issues without ID", async (t) => {
1717
const owner = "test_user";
1818
const repo = "test_repo";
1919
const title = "The automated release is failing 🚨";
@@ -57,7 +57,7 @@ test.serial("Filter out issues without ID", async (t) => {
5757
t.true(fetch.done());
5858
});
5959

60-
test.serial("Return empty array if not issues found", async (t) => {
60+
test("Return empty array if not issues found", async (t) => {
6161
const owner = "test_user";
6262
const repo = "test_repo";
6363
const title = "The automated release is failing 🚨";
@@ -85,7 +85,7 @@ test.serial("Return empty array if not issues found", async (t) => {
8585
t.true(fetch.done());
8686
});
8787

88-
test.serial("Return empty array if not issues has matching ID", async (t) => {
88+
test("Return empty array if not issues has matching ID", async (t) => {
8989
const owner = "test_user";
9090
const repo = "test_repo";
9191
const title = "The automated release is failing 🚨";

0 commit comments

Comments
 (0)