-
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
Showing
5 changed files
with
63 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Render App Component Without Error Should render App 1`] = `ShallowWrapper {}`; |
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,38 @@ | ||
import CartActionTypes from "./cart.types"; | ||
import { | ||
toggleCartHidden, | ||
addItem, | ||
removeItem, | ||
clearItemFromCart | ||
} from "./cart.actions"; | ||
|
||
it("should create an action to toggleCartHidden", () => { | ||
const expectedAction = { | ||
type: CartActionTypes.TOGGLE_CART_HIDDEN | ||
}; | ||
expect(toggleCartHidden()).toEqual(expectedAction); | ||
}); | ||
it("should create an action to addItem", () => { | ||
const item = { id: 2, title: "test 2" }; | ||
const expectedAction = { | ||
type: CartActionTypes.ADD_ITEM, | ||
payload: item | ||
}; | ||
expect(addItem(item)).toEqual(expectedAction); | ||
}); | ||
it("should create an action to removeItem", () => { | ||
const item = { id: 2, title: "test 2" }; | ||
const expectedAction = { | ||
type: CartActionTypes.REMOVE_ITEM, | ||
payload: item | ||
}; | ||
expect(removeItem(item)).toEqual(expectedAction); | ||
}); | ||
it("should create an action to clearItemFromCart", () => { | ||
const item = { id: 2, title: "test 2" }; | ||
const expectedAction = { | ||
type: CartActionTypes.CLEAR_ITEM_FROM_CART, | ||
payload: item | ||
}; | ||
expect(clearItemFromCart(item)).toEqual(expectedAction); | ||
}); |
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,11 @@ | ||
import { UserActionTypes } from "./user.types"; | ||
import { setCurrentUser } from "./user.actions"; | ||
|
||
it("should create an action to setCurrentUser", () => { | ||
const user = { id: 2, email: "[email protected]" }; | ||
const expectedAction = { | ||
type: UserActionTypes.SET_CURRENT_USER, | ||
payload: user | ||
}; | ||
expect(setCurrentUser(user)).toEqual(expectedAction); | ||
}); |