it('fetches a .gitlab-ci.yml', done => { const gitlabCiYmlKey = 'Y CI ML'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/templates/gitlab_ci_ymls/${gitlabCiYmlKey}`; mock.onGet(expectedUrl).reply(200, 'test'); Api.gitlabCiYml(gitlabCiYmlKey, response => { expect(response).toBe('test'); done(); }); });
it('fetches a .gitlab-ci.yml', (done) => { const gitlabCiYmlKey = 'Y CI ML'; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/templates/gitlab_ci_ymls/${gitlabCiYmlKey}`; spyOn(jQuery, 'get').and.callFake((url, callback) => { expect(url).toEqual(expectedUrl); callback(dummyResponse); }); Api.gitlabCiYml(gitlabCiYmlKey, (response) => { expect(response).toBe(dummyResponse); done(); }); });