| 10 | }); |
| 11 | |
| 12 | function mockAPI(api, responses) { |
| 13 | api.request = jest.fn().mockImplementation((path, options = {}) => { |
| 14 | const normalizedPath = path.indexOf('?') !== -1 ? path.slice(0, path.indexOf('?')) : path; |
| 15 | const response = responses[normalizedPath]; |
| 16 | return typeof response === 'function' |
| 17 | ? Promise.resolve(response(options)) |
| 18 | : Promise.reject(new Error(`No response for path '${normalizedPath}'`)); |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | describe('editorialWorkflowGit', () => { |
| 23 | it('should create PR with correct base branch name when publishing with editorial workflow', () => { |