Fixed tests

This commit is contained in:
Philipp Czora
2018-07-17 17:00:45 +02:00
parent 0f87b61329
commit 727318124c
3 changed files with 47 additions and 48 deletions

View File

@@ -222,8 +222,8 @@ describe("fetch tests", () => {
describe("reducer tests", () => {
test("users request", () => {
var newState = reducer({}, { type: FETCH_USERS });
expect(newState.users.loading).toBeTruthy();
expect(newState.users.error).toBeNull();
expect(newState.loading).toBeTruthy();
expect(newState.error).toBeNull();
});
test("fetch users successful", () => {
@@ -250,8 +250,8 @@ describe("reducer tests", () => {
test("delete user requested", () => {
const state = {
usersByNames : {
"zaphod": {
usersByNames: {
zaphod: {
loading: false,
error: null,
entry: userZaphod
@@ -263,17 +263,17 @@ describe("reducer tests", () => {
const zaphod = newState.usersByNames["zaphod"];
expect(zaphod.loading).toBeTruthy();
expect(zaphod.entry).toBe(userZaphod);
})
});
it("should not effect other users if one user will be deleted", () => {
const state = {
usersByNames : {
"zaphod": {
usersByNames: {
zaphod: {
loading: false,
error: null,
entry: userZaphod
},
"ford": {
ford: {
loading: false
}
}
@@ -286,8 +286,8 @@ describe("reducer tests", () => {
it("should set the error of user which could not be deleted", () => {
const state = {
usersByNames : {
"zaphod": {
usersByNames: {
zaphod: {
loading: false,
error: null,
entry: userZaphod
@@ -304,13 +304,13 @@ describe("reducer tests", () => {
it("should not effect other users if one user could not be deleted", () => {
const state = {
usersByNames : {
"zaphod": {
usersByNames: {
zaphod: {
loading: false,
error: null,
entry: userZaphod
},
"ford": {
ford: {
loading: false
}
}
@@ -322,7 +322,6 @@ describe("reducer tests", () => {
expect(ford.loading).toBeFalsy();
});
test("reducer does not replace whole usersByNames map", () => {
const oldState = {
usersByNames: {
@@ -339,7 +338,6 @@ describe("reducer tests", () => {
expect(newState.usersByNames["zaphod"]).toBeDefined();
expect(newState.usersByNames["ford"]).toBeDefined();
});
test("edit user", () => {
const newState = reducer(