Skip to content

Commit

Permalink
Update Jest & Enzyme, Add snapshot tests (#307)
Browse files Browse the repository at this point in the history
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Update Jest & Enzyme, Add snapshot tests

* Fix tslint errors in /spec, Update mock localstorage

* Update types in tests, Fix tslint error

* Specify module versions for browser

* Update sendTransaction snapshot
  • Loading branch information
james-prado authored and dternyak committed Oct 25, 2017
1 parent 9095fc0 commit 70a2b3c
Show file tree
Hide file tree
Showing 29 changed files with 1,446 additions and 859 deletions.
6 changes: 3 additions & 3 deletions common/libs/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ interface ABITypedSlot {

interface ABIMethod {
name: string;
type: 'function';
constant: boolean;
type: string;
constant?: boolean;
inputs: ABITypedSlot[];
outputs: ABITypedSlot[];
outputs?: ABITypedSlot[];
// default - false
payable?: boolean;
}
Expand Down
1 change: 1 addition & 0 deletions jest_config/__mocks__/fileMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default class LocalStorageMock {
class LocalStorageMock {
private store: object;

constructor() {
Expand All @@ -21,3 +21,7 @@ export default class LocalStorageMock {
delete this.store[key];
}
}

Object.defineProperty(window, 'localStorage', {
value: new LocalStorageMock()
});
1 change: 1 addition & 0 deletions jest_config/__mocks__/styleMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
23 changes: 14 additions & 9 deletions jest_config/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"rootDir": "../",
"transform": {
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
],
"moduleDirectories": ["node_modules", "common"],
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/jest_config/__mocks__/fileMock.ts",
"\\.(css|scss|less)$": "<rootDir>/jest_config/__mocks__/styleMock.ts"
},
"testPathIgnorePatterns": ["<rootDir>/common/config"],
"setupFiles": ["<rootDir>/jest_config/setupJest.js"],
"setupFiles": [
"<rootDir>/jest_config/setupJest.js",
"<rootDir>/jest_config/__mocks__/localStorage.ts"
],
"automock": false,
"moduleDirectories": ["node_modules", "common"]
"snapshotSerializers": ["enzyme-to-json/serializer"],
"browser": true
}
Loading

0 comments on commit 70a2b3c

Please sign in to comment.