Skip to content

Commit

Permalink
Merge pull request #59 from Turbo87/refactorings
Browse files Browse the repository at this point in the history
Refactorings and code simplification
  • Loading branch information
hzoo authored Jun 6, 2017
2 parents 26dd69c + 7a17845 commit f8caa2e
Show file tree
Hide file tree
Showing 22 changed files with 466 additions and 433 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"dependencies": {
"chalk": "^1.1.3",
"fs-extra": "^2.0.0",
"mkdirp": "^0.5.1",
"node-fetch": "^1.7.0",
"p-map": "^1.1.1",
Expand All @@ -43,7 +44,6 @@
"devDependencies": {
"@types/jest": "^19.2.3",
"@types/node": "^7.0.22",
"fs-extra": "^2.0.0",
"jest": "^20.0.4",
"rimraf": "^2.5.4",
"ts-jest": "^20.0.4",
Expand Down
46 changes: 0 additions & 46 deletions src/ApiDataCache.ts

This file was deleted.

239 changes: 0 additions & 239 deletions src/Changelog.spec.ts

This file was deleted.

51 changes: 0 additions & 51 deletions src/GithubAPI.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/__mocks__/ApiDataCache.ts

This file was deleted.

28 changes: 28 additions & 0 deletions src/__mocks__/api-data-cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
let localCache: { [id: string]: any } = {};
export function __resetDefaults() {
localCache = {};
}
export function __setCache(cache: any) {
localCache = {};
for (const key of Object.keys(cache)) {
let value = cache[key];

for (const key2 of Object.keys(value)) {
let value2 = value[key2];
let combinedKey = `${key}/${key2}`;
localCache[combinedKey] = value2;
}
}
}

class MockedApiDataCache {
get(key: string) {
return localCache[key];
}

async getOrRequest(key: string) {
return this.get(key);
}
}

export default MockedApiDataCache;
Loading

0 comments on commit f8caa2e

Please sign in to comment.