Skip to content

Commit

Permalink
Updated test script. Updated mock to match repos user
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoo90 committed Apr 25, 2017
1 parent 07b1336 commit de58210
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"develop": "webpack-dev-server --open --config ./webpack.config.dev.js --inline --progress",
"serve": "webpack --config ./webpack.config.prod.js -p --progress --profile --bail && http-server ./build -o",
"setup": "rimraf ./src/services/credentials.ts && cp ./src/services/credentials.ts.tmpl ./src/services/credentials.ts",
"test": "export TEST_REPORT_PATH=./reports/test-results && eslint ./src/**/**/*.spec.jsx && jest --config ./jest.config.json"
"test": "npm run clean && export TEST_REPORT_PATH=./reports/test-results && eslint ./src/**/**/*.spec.jsx && jest --coverage --config ./jest.config.json"
},
"dependencies": {
"@types/react-addons-test-utils": "^0.14.18",
Expand Down
4 changes: 2 additions & 2 deletions src/services/__mocks__/credentials.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export class Credentials {
getCredentials() {
return {
accessToken: 'mockUser',
username: 'mockToken'
accessToken: 'mockToken',
username: 'thescientist13'
}
}
}
4 changes: 2 additions & 2 deletions src/services/github-api.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('GitHub API Service', () => {
it('should test getIssuesForRepository (personal) returns correctly modeled data', () => {
const repoName = 'github-dashboard';

mockAxios.onGet(`https://api.github.com/users/${mockCredentials.username}/${repoName}/issues`).reply(200, MOCK_ISSUES_FOR_REPOSITORY);
mockAxios.onGet(`https://api.github.com/repos/${mockCredentials.username}/${repoName}/issues`).reply(200, MOCK_ISSUES_FOR_REPOSITORY);

new GithubApi(mockCredentials).getIssuesForRepository(repoName).then((response) => {
expect(response.pullRequests).toEqual(3);
Expand All @@ -95,7 +95,7 @@ describe('GitHub API Service', () => {
it('should test getIssuesForRepository (subscribed) returns correctly modeled data', () => {
const repoName = 'spinikube';

mockAxios.onGet(`https://api.github.com/users/${mockCredentials.username}/${repoName}/issues`).reply(200, MOCK_ISSUES_FOR_SUBSCRIPTION);
mockAxios.onGet(`https://api.github.com/repos/${mockCredentials.username}/${repoName}/issues`).reply(200, MOCK_ISSUES_FOR_SUBSCRIPTION);

new GithubApi(mockCredentials).getIssuesForRepository(repoName).then((response) => {
expect(response.pullRequests).toEqual(1);
Expand Down

0 comments on commit de58210

Please sign in to comment.