Skip to content

Commit

Permalink
Add a test for non-Windows that just throws
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt committed Nov 9, 2024
1 parent e2096b7 commit f438f9a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions extensions/msal-node-extensions/test/dpapi-addon/Dpapi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { DataProtectionScope } from "../../src/persistence/DataProtectionScope";
import { platform } from "process";

// DPAPI is only available on windows
if (platform === "win32") {
describe("Test DPAPI addon", () => {
describe("Test DPAPI addon", () => {
if (platform === "win32") {
test("Protect and Unprotect data", () => {
const data = Buffer.from("DPAPITestString");

Expand Down Expand Up @@ -58,8 +58,10 @@ if (platform === "win32") {
);
expect(decryptedData).toEqual(data);
});
});
} else {
// Jest require that a .spec.ts file contain at least one test.
test("Empty test", () => {});
}
} else {
test("Should throw on non-Windows", () => {
const data = Buffer.from("DPAPITestString");
expect(() => Dpapi.protectData(data, null, DataProtectionScope.LocalMachine)).toThrow();
});
}
});

0 comments on commit f438f9a

Please sign in to comment.