fix(aio): remove unnecessary repoSlug parameter from GithubApi

This commit is contained in:
Georgios Kalpakas
2017-02-28 14:17:20 +02:00
committed by Chuck Jazdzewski
parent 951e653b0c
commit 060d02eb82
5 changed files with 20 additions and 19 deletions

View File

@ -8,18 +8,13 @@ import {GithubApi} from '../../lib/common/github-api';
describe('GithubApi', () => {
let api: GithubApi;
beforeEach(() => api = new GithubApi('repo/slug', '12345'));
beforeEach(() => api = new GithubApi('12345'));
describe('constructor()', () => {
it('should throw if \'repoSlug\' is missing or empty', () => {
expect(() => new GithubApi('', '12345')).toThrowError('Missing or empty required parameter \'repoSlug\'!');
});
it('should throw if \'githubToken\' is missing or empty', () => {
expect(() => new GithubApi('repo/slug', '')).toThrowError('Missing or empty required parameter \'githubToken\'!');
expect(() => new GithubApi('')).toThrowError('Missing or empty required parameter \'githubToken\'!');
});
});
@ -172,7 +167,7 @@ describe('GithubApi', () => {
it('should reject if the request fails', done => {
(api as any).getPaginated('/foo/bar').catch(err => {
(api as any).getPaginated('/foo/bar').catch((err: any) => {
expect(err).toBe('Test');
done();
});

View File

@ -6,15 +6,15 @@ describe('GithubPullRequests', () => {
describe('constructor()', () => {
it('should throw if \'repoSlug\' is missing or empty', () => {
expect(() => new GithubPullRequests('', '12345')).
toThrowError('Missing or empty required parameter \'repoSlug\'!');
it('should throw if \'githubToken\' is missing or empty', () => {
expect(() => new GithubPullRequests('', 'foo/bar')).
toThrowError('Missing or empty required parameter \'githubToken\'!');
});
it('should throw if \'githubToken\' is missing or empty', () => {
expect(() => new GithubPullRequests('foo/bar', '')).
toThrowError('Missing or empty required parameter \'githubToken\'!');
it('should throw if \'repoSlug\' is missing or empty', () => {
expect(() => new GithubPullRequests('12345', '')).
toThrowError('Missing or empty required parameter \'repoSlug\'!');
});
});
@ -25,7 +25,7 @@ describe('GithubPullRequests', () => {
let deferred: {resolve: Function, reject: Function};
beforeEach(() => {
prs = new GithubPullRequests('foo/bar', '12345');
prs = new GithubPullRequests('12345', 'foo/bar');
spyOn(prs, 'post').and.callFake(() => new Promise((resolve, reject) => deferred = {resolve, reject}));
});
@ -81,7 +81,7 @@ describe('GithubPullRequests', () => {
let prsGetPaginatedSpy: jasmine.Spy;
beforeEach(() => {
prs = new GithubPullRequests('foo/bar', '12345');
prs = new GithubPullRequests('12345', 'foo/bar');
prsGetPaginatedSpy = spyOn(prs as any, 'getPaginated');
spyOn(console, 'log');
});