workspace-tools
Version:
A collection of tools that are useful in a git-controlled monorepo that is managed by one of these software:
27 lines (26 loc) • 883 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const setupFixture_1 = require("../helpers/setupFixture");
const git_1 = require("../git");
describe("getDefaultBranch()", () => {
afterAll(() => {
setupFixture_1.cleanupFixtures();
});
it("is main in the default test repo", () => {
// arrange
const cwd = setupFixture_1.setupFixture("basic");
// act
const branch = git_1.getDefaultBranch(cwd);
// assert
expect(branch).toBe("main");
});
it("is myMain when default branch is different", () => {
// arrange
const cwd = setupFixture_1.setupFixture("basic");
git_1.git(['config', 'init.defaultBranch', 'myMain'], { cwd });
// act
const branch = git_1.getDefaultBranch(cwd);
// assert
expect(branch).toBe("myMain");
});
});