test(aio): add missing unit test for preview server

This commit is contained in:
Georgios Kalpakas 2017-06-19 01:07:27 +03:00 committed by Matias Niemelä
parent 3112311134
commit a98440bb85
1 changed files with 24 additions and 0 deletions

View File

@ -76,6 +76,30 @@ describe('GithubPullRequests', () => {
});
describe('fetch()', () => {
let prs: GithubPullRequests;
let prsGetSpy: jasmine.Spy;
beforeEach(() => {
prs = new GithubPullRequests('12345', 'foo/bar');
prsGetSpy = spyOn(prs as any, 'get');
});
it('should call \'get()\' with the correct pathname', () => {
prs.fetch(42);
expect(prsGetSpy).toHaveBeenCalledWith('/repos/foo/bar/issues/42');
});
it('should forward the value returned by \'get()\'', () => {
prsGetSpy.and.returnValue('Test');
expect(prs.fetch(42) as any).toBe('Test');
});
});
describe('fetchAll()', () => {
let prs: GithubPullRequests;
let prsGetPaginatedSpy: jasmine.Spy;