backport
Version:
A CLI tool that automates the process of backporting commits
27 lines • 1.09 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = __importDefault(require("os"));
const env_1 = require("./env");
describe('env', () => {
beforeEach(() => {
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
});
describe('getGlobalConfigPath', () => {
it('uses homedir when no argument is given', () => {
expect((0, env_1.getGlobalConfigPath)(undefined)).toBe('/myHomeDir/.backport/config.json');
});
it('uses custom config when given', () => {
expect((0, env_1.getGlobalConfigPath)('/my/path/to/global/config.json')).toBe('/my/path/to/global/config.json');
});
});
it('getRepoPath', () => {
expect((0, env_1.getRepoPath)({
repoOwner: 'elastic',
repoName: 'kibana',
})).toBe('/myHomeDir/.backport/repositories/elastic/kibana');
});
});
//# sourceMappingURL=env.test.js.map