Skip to content

Commit

Permalink
fix(code): cli-kit platform unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crherman7 committed Mar 25, 2024
1 parent d2d47c4 commit e218a07
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/cli-kit/__tests__/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
canRunIOS,
canRunAndroid,
} from "../src/lib/platform";
import * as platform from "../src/lib/platform";
import type { PrebuildOptions } from "../src/@types/config";

describe("Operating System Utilities", () => {
Expand All @@ -27,6 +28,20 @@ describe("Operating System Utilities", () => {
});

describe("canRunIOS", () => {
let origionalIsOSX = isOSX;

beforeAll(() => {
Object.defineProperty(platform, "isOSX", {
value: true,
});
});

afterAll(() => {
Object.defineProperty(platform, "isOSX", {
value: origionalIsOSX,
});
});

it('should return true for macOS and platform "ios"', () => {
const options = { platform: "ios" } as PrebuildOptions;
expect(canRunIOS(options)).toBe(true);
Expand All @@ -44,6 +59,20 @@ describe("Operating System Utilities", () => {
});

describe("canRunAndroid", () => {
let origionalIsOSX = isOSX;

beforeAll(() => {
Object.defineProperty(platform, "isOSX", {
value: true,
});
});

afterAll(() => {
Object.defineProperty(platform, "isOSX", {
value: origionalIsOSX,
});
});

it('should return true for macOS, Linux, or Windows and platform "android"', () => {
const options = { platform: "android" } as PrebuildOptions;
expect(canRunAndroid(options)).toBe(true);
Expand Down

0 comments on commit e218a07

Please sign in to comment.