-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anton Horn
committed
Feb 23, 2019
1 parent
17371e7
commit ec49ed2
Showing
3 changed files
with
107 additions
and
163 deletions.
There are no files selected for viewing
163 changes: 0 additions & 163 deletions
163
app/assets/scripts/modules/reducers/repositories.test.js
This file was deleted.
Oops, something went wrong.
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,48 @@ | ||
|
||
import deepFreeze from "deep-freeze"; | ||
import reducer from "../../app/assets/scripts/modules/reducers/languages"; | ||
import ActionType from "../../app/assets/scripts/modules/actions/ActionType"; | ||
|
||
describe("reducer-languages", () => { | ||
it("should handle RECEIVE_REPOSITORY_LANGUAGES action", () => { | ||
const stateBefore = [ | ||
{ | ||
repositoryId: "kh123k", | ||
isFetching: false, | ||
errorMessage: null, | ||
data: [ "CSS", "Html", "Javascript" ] | ||
}, | ||
{ | ||
repositoryId: "sdfr3sy", | ||
isFetching: false, | ||
errorMessage: null, | ||
data: [ "CSS", "Javascript", "PHP" ] | ||
} | ||
] | ||
const stateAfter = [ | ||
{ | ||
repositoryId: "kh123k", | ||
isFetching: false, | ||
errorMessage: null, | ||
data: [ "CSS", "Html", "Javascript" ] | ||
}, | ||
{ | ||
repositoryId: "sdfr3sy", | ||
isFetching: false, | ||
errorMessage: null, | ||
data: [ "C++", "PHP", "Python" ] | ||
} | ||
]; | ||
|
||
const action = { | ||
type: ActionType.RECEIVE_REPOSITORY_LANGUAGES, | ||
repositoryId: "sdfr3sy", | ||
data: [ "C++", "PHP", "Python" ] | ||
} | ||
|
||
deepFreeze(stateBefore); | ||
deepFreeze(action); | ||
|
||
expect(reducer(stateBefore, action)).toEqual(stateAfter); | ||
}); | ||
}); |
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,59 @@ | ||
import deepFreeze from "deep-freeze"; | ||
import reducer from "../../app/assets/scripts/modules/reducers/repositories"; | ||
import ActionType from "../../app/assets/scripts/modules/actions/ActionType"; | ||
|
||
describe("reducer-repositories", () => { | ||
|
||
it("should handle RECEIVE_REPOSITORIES action", () => { | ||
const stateBefore = { | ||
username: "friend", | ||
isFetching: false, | ||
errorMessage: null, | ||
data: [] | ||
}; | ||
|
||
const stateAfter = { | ||
username: "friend", | ||
isFetching: false, | ||
errorMessage: null, | ||
data: [ | ||
{ | ||
id: "kh123k", | ||
name: "", | ||
description: "", | ||
website: "" | ||
}, | ||
{ | ||
id: "82jd9jk", | ||
name: "", | ||
description: "", | ||
website: "" | ||
} | ||
] | ||
}; | ||
|
||
const action = { | ||
type: ActionType.RECEIVE_REPOSITORIES, | ||
username: "friend", | ||
data: [ | ||
{ | ||
id: "kh123k", | ||
name: "", | ||
description: "", | ||
website: "" | ||
}, | ||
{ | ||
id: "82jd9jk", | ||
name: "", | ||
description: "", | ||
website: "" | ||
} | ||
] | ||
}; | ||
|
||
deepFreeze(stateBefore); | ||
deepFreeze(action); | ||
|
||
expect(reducer(stateBefore, action)).toEqual(stateAfter); | ||
}); | ||
}); |