Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Aug 29, 2024
1 parent 1fda8dc commit e617611
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/cli/test/bin/context.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { Command } from "@react-native-community/cli-types";
import { getCoreCommands, loadContext, uniquify } from "../../src/bin/context";
import {
getCoreCommands,
loadContextForCommand,
uniquify,
} from "../../src/bin/context";
import { reactNativeConfig } from "../../src/index";

jest.mock("@rnx-kit/tools-react-native/context", () => ({
Expand Down Expand Up @@ -48,19 +52,19 @@ describe("bin/context/uniquify()", () => {
});
});

describe("bin/context/loadContext()", () => {
describe("bin/context/loadContextForCommand()", () => {
afterAll(() => {
jest.resetAllMocks();
});

it("uses fast code path for rnx commands", () => {
for (const { name } of getCoreCommands()) {
expect(() => loadContext(name)).not.toThrow();
expect(() => loadContextForCommand(name)).not.toThrow();
}
});

it("uses full code path for other commands", () => {
expect(() => loadContext("run-android")).toThrow();
expect(() => loadContext("run-ios")).toThrow();
expect(() => loadContextForCommand("run-android")).toThrow();
expect(() => loadContextForCommand("run-ios")).toThrow();
});
});

0 comments on commit e617611

Please sign in to comment.