cli-retrospective
Version:
Recall what you did on the last milestone
57 lines (55 loc) • 1.6 kB
JavaScript
var _config = require("../config");
jest.mock('fs', function () {
return {
'existsSync': jest.fn(function () {
return true;
}).mockImplementationOnce(function () {
return false;
}).mockImplementationOnce(function () {
return true;
}).mockImplementationOnce(function () {
return false;
}).mockImplementationOnce(function () {
return true;
}),
'writeFile': jest.fn()
};
});
jest.mock('../../config.json', function () {
return {
'githubUsername': 'trentreznor',
'githubPassword': 'closer',
'repositoryOwner': 'nin',
'repository': 'the-downward-spiral'
};
}, {
virtual: true
});
describe('use config', function () {
it('check configExists fail', function () {
expect((0, _config.configExist)()).toBe(false);
});
it('check configExists success', function () {
expect((0, _config.configExist)()).toBe(true);
});
it('check config values without config', function () {
var config = (0, _config.configGetValues)();
});
it('check config values', function () {
var config = (0, _config.configGetValues)();
expect(config.githubUsername).toBe('trentreznor');
expect(config.githubPassword).toBe('closer');
expect(config.repositoryOwner).toBe('nin');
expect(config.repository).toBe('the-downward-spiral');
});
it('check configSave', function () {
var values = {
'githubUsername': 'trentreznor',
'githubPassword': 'closer',
'repository': 'nin',
'repositoryOwner': 'the-downward-spiral'
};
(0, _config.configSave)(values);
});
});
;