Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactorings and code simplification #59

Merged
merged 15 commits into from
Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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