Skip to content

Commit

Permalink
Update index.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Jun 6, 2024
1 parent 4dc13e0 commit 7323e57
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/__test__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as UpdateMain from "../write-file";
import * as core from "@actions/core";
import * as ListPlaylists from "../list-playlists";
import { promises } from "fs";
import * as github from "@actions/github";

jest.mock("@actions/core");
jest.mock("spotify-web-api-node", () => {
Expand Down Expand Up @@ -140,4 +141,30 @@ describe("action", () => {
]
`);
});

test("workflow input task precedence", async () => {
Object.defineProperty(github, "context", {
value: {
payload: {
inputs: {
"playlist-name": "2021 Fall",
},
},
},
});
defaultInputs["playlist-name"] = "2019 Fall";

jest.spyOn(promises, "readFile").mockResolvedValue(`
- playlist: 2021 Summer
`);
const exportVariableSpy = jest.spyOn(core, "exportVariable");

await action();

expect(exportVariableSpy).toHaveBeenNthCalledWith(
1,
"playlist",
"2021 Fall"
);
});
});

0 comments on commit 7323e57

Please sign in to comment.