forked from github/vscode-codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-notes.test.ts
More file actions
42 lines (35 loc) · 1.36 KB
/
Copy pathrelease-notes.test.ts
File metadata and controls
42 lines (35 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { env, Uri, window } from "vscode";
import {
codeQlCliReleaseNotesUrl,
offerCodeQlCliReleaseNotes,
} from "../../../../src/codeql-cli/distribution/release-notes";
describe("offerCodeQlCliReleaseNotes", () => {
const updateMessage = 'CodeQL CLI updated to version "v2.23.0".';
let showInformationMessageSpy: jest.SpiedFunction<
typeof window.showInformationMessage
>;
let openExternalSpy: jest.SpiedFunction<typeof env.openExternal>;
beforeEach(() => {
showInformationMessageSpy = jest
.spyOn(window, "showInformationMessage")
.mockResolvedValue(undefined);
openExternalSpy = jest.spyOn(env, "openExternal").mockResolvedValue(true);
});
it("opens the CLI changelog when the release-notes action is selected", async () => {
showInformationMessageSpy.mockImplementationOnce((...args) =>
Promise.resolve(args[1]),
);
await offerCodeQlCliReleaseNotes(updateMessage);
expect(showInformationMessageSpy).toHaveBeenCalledWith(updateMessage, {
title: "Show release notes",
isCloseAffordance: false,
});
expect(openExternalSpy).toHaveBeenCalledWith(
Uri.parse(codeQlCliReleaseNotesUrl),
);
});
it("does not open the changelog when the message is dismissed", async () => {
await offerCodeQlCliReleaseNotes(updateMessage);
expect(openExternalSpy).not.toHaveBeenCalled();
});
});