Skip to content

Commit

Permalink
Add async keyword to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smac89 committed Nov 17, 2022
1 parent d5ec873 commit 39836e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ describe("findLatestReleases()", () => {

jest.mock('src/functions');

return await import('src/functions').then(({default: {findLatestReleases, releaseTag}}) => {
return await import('src/functions').then(async ({default: {findLatestReleases, releaseTag}}) => {
// @ts-expect-error
releaseTag.mockedTag = `v${currentTag}`;
// See __mocks__/functions.ts for why the above is done
return findLatestReleases(octokit).then(({ repoLatest }) => {
expect(spyOctokit).toHaveBeenCalledTimes(1);
expect(repoLatest).toBe(currentTag);
Expand Down
6 changes: 3 additions & 3 deletions tests/preferences.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ describe("preferences.publishLatestTag", () => {
expect(preferences.publishLatestTag).toBe(false)
));

it("Should have been set to true when deprecated input is true", () => {
it("Should have been set to true when deprecated input is true", async () => {
process.env.INPUT_PUBLISH_LATEST = "true";
return import("src").then(({ preferences }) =>
expect(preferences.publishLatestTag).toBe(true)
);
});

it("Should have been set to true when input is true", () => {
it("Should have been set to true when input is true", async () => {
process.env.INPUT_PUBLISH_LATEST_TAG = "true";
return import("src").then(({ preferences }) =>
expect(preferences.publishLatestTag).toBe(true)
Expand All @@ -27,7 +27,7 @@ describe("preferences.preferBranchRelease", () => {
expect(preferences.preferBranchRelease).toBe(false)
));

it("Should have been set to true when input is true", () => {
it("Should have been set to true when input is true", async () => {
process.env.INPUT_PREFER_BRANCH_RELEASES = "true";
return import("src").then(({ preferences }) =>
expect(preferences.preferBranchRelease).toBe(true)
Expand Down

0 comments on commit 39836e5

Please sign in to comment.