Skip to content
Snippets Groups Projects
Commit 5f6cf321 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

Add missing ensurePr tests (#176)

parent 4097b829
No related branches found
No related tags found
No related merge requests found
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`helpers/versions .determineUpgrades(dep, currentVersion, defaultConfig) returns only one update if grouping 1`] = `
Array [
Object {
"changeLogFromVersion": "0.4.4",
"changeLogToVersion": "1.4.1",
"newVersion": "1.4.1",
"newVersionMajor": 1,
"upgradeType": "major",
},
]
`;
...@@ -29,6 +29,32 @@ describe('workers/pr', () => { ...@@ -29,6 +29,32 @@ describe('workers/pr', () => {
const pr = await prWorker.ensurePr(config); const pr = await prWorker.ensurePr(config);
expect(pr).toBe(null); expect(pr).toBe(null);
}); });
it('should return null if waiting for success', async () => {
config.api.getBranchStatus = jest.fn(() => 'failed');
config.prCreation = 'status-success';
const pr = await prWorker.ensurePr(config);
expect(pr).toBe(null);
});
it('should create PR if success', async () => {
config.api.getBranchStatus = jest.fn(() => 'success');
config.api.getBranchPr = jest.fn();
config.prCreation = 'status-success';
const pr = await prWorker.ensurePr(config);
expect(pr).toMatchObject({ displayNumber: 'New Pull Request' });
});
it('should return null if waiting for not pending', async () => {
config.api.getBranchStatus = jest.fn(() => 'pending');
config.prCreation = 'not-pending';
const pr = await prWorker.ensurePr(config);
expect(pr).toBe(null);
});
it('should create PR if no longer pending', async () => {
config.api.getBranchStatus = jest.fn(() => 'failed');
config.api.getBranchPr = jest.fn();
config.prCreation = 'not-pending';
const pr = await prWorker.ensurePr(config);
expect(pr).toMatchObject({ displayNumber: 'New Pull Request' });
});
it('should create new branch if none exists', async () => { it('should create new branch if none exists', async () => {
config.api.getBranchPr = jest.fn(); config.api.getBranchPr = jest.fn();
const pr = await prWorker.ensurePr(config); const pr = await prWorker.ensurePr(config);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment