This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from onaio/bug/tests-on-staging
Establish v1.3.1
- Loading branch information
Showing
8 changed files
with
341 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { APP } from '../../../src/store/reducers'; | ||
import defaultState from '../../../src/store/defaultState'; | ||
import { INIT_APP } from '../../../src/store/constants/actionTypes'; | ||
|
||
describe('APP', () => { | ||
it('should return the initial state', () => { | ||
expect(APP(undefined, {})).toEqual(defaultState.APP); | ||
}); | ||
|
||
it('should handle INIT_APP', () => { | ||
const action = { | ||
type: INIT_APP, | ||
config: { | ||
accessToken: false, | ||
appName: 'React Gisida', | ||
loaded: false, | ||
mapConfig: { | ||
center: [0, 0], | ||
container: 'map', | ||
style: '', | ||
zoom: 10, | ||
}, | ||
}, | ||
}; | ||
// Case 1: The state obj is empty | ||
const stateEmpty = {}; | ||
expect(APP(stateEmpty, action)).toEqual({ | ||
...stateEmpty, | ||
...action.config, | ||
loaded: true, | ||
}); | ||
|
||
// Case 2: The state obj is not empty | ||
const stateOld = { | ||
accessToken: false, | ||
appName: 'Old App Name', | ||
loaded: true, | ||
mapConfig: { | ||
center: [0, 0], | ||
container: 'map', | ||
style: '', | ||
zoom: 10, | ||
}, | ||
}; | ||
|
||
expect(APP(stateOld, action)).toEqual({ | ||
...stateOld, | ||
...action.config, | ||
loaded: true, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.