-
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
27 changed files
with
397 additions
and
79 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
react-context-api/src/components/cart-dropdown/cart-dropdown.component.test.js
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,28 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CartDropdownComponent from "./cart-dropdown.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow( | ||
<CartDropdownComponent {...props}></CartDropdownComponent> | ||
); | ||
return component; | ||
}; | ||
|
||
describe("CartDropdown Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
history: {}, | ||
cartItems: [], | ||
toggleCartHidden: jest.fn() | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "cart-dropdown-component"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
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
25 changes: 25 additions & 0 deletions
25
react-context-api/src/components/cart-icon/cart-icon.component.test.js
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,25 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CartIcon from "./cart-icon.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<CartIcon {...props}></CartIcon>); | ||
return component; | ||
}; | ||
|
||
describe("CartIcon Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
itemCount: 0, | ||
toggleCartHidden: jest.fn() | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "cart-icon"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
14 changes: 7 additions & 7 deletions
14
react-context-api/src/components/cart-item/cart-item.component.jsx
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
24 changes: 24 additions & 0 deletions
24
react-context-api/src/components/cart-item/cart-item.component.test.js
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,24 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CartItem from "./cart-item.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<CartItem {...props}></CartItem>); | ||
return component; | ||
}; | ||
|
||
describe("CartItem Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
item: { imageUrl: "", price: 0, name: "", quantity: 1 } | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "cart-item"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
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
27 changes: 27 additions & 0 deletions
27
react-context-api/src/components/checkout-item/chekout-item.component.test.js
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,27 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CheckoutItem from "./checkout-item.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<CheckoutItem {...props}></CheckoutItem>); | ||
return component; | ||
}; | ||
|
||
describe("CheckoutItem Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
cartItem: { name: "", imageUrl: "", price: 12, quantity: 0 }, | ||
clearItem: jest.fn(), | ||
addItem: jest.fn(), | ||
removeItem: jest.fn() | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "checkout-item"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
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
25 changes: 25 additions & 0 deletions
25
react-context-api/src/components/collection-item/collection-item.component.test.js
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,25 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CollectionItem from "./collection-item.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<CollectionItem {...props}></CollectionItem>); | ||
return component; | ||
}; | ||
|
||
describe("CollectionItem Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
item: { name: "", price: 1, imageUrl: "" }, | ||
addItem: jest.fn() | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "collection-item"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
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
25 changes: 25 additions & 0 deletions
25
react-context-api/src/components/collection-preview/collection-preview.component.test.js
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,25 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CollectionPreview from "./collection-preview.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<CollectionPreview {...props}></CollectionPreview>); | ||
return component; | ||
}; | ||
|
||
describe("CollectionPreview Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
title: "", | ||
items: [] | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "collection-preview"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
react-context-api/src/components/collections-overview/collection-overview.component.test.js
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,26 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CollectionOverview from "./collections-overview.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow( | ||
<CollectionOverview {...props}></CollectionOverview> | ||
); | ||
return component; | ||
}; | ||
|
||
describe("CartDropdown Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
collections: [] | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "collections-overview"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
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
22 changes: 22 additions & 0 deletions
22
react-context-api/src/components/custom-button/custom-button.component.test.js
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,22 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import CustomButton from "./custom-button.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<CustomButton {...props}></CustomButton>); | ||
return component; | ||
}; | ||
|
||
describe("CustomButton Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = {}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "custom-button"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
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
24 changes: 24 additions & 0 deletions
24
react-context-api/src/components/directory/directory.component.test.js
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,24 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import Directory from "./directory.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<Directory {...props}></Directory>); | ||
return component; | ||
}; | ||
|
||
describe("Directory Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
sections: [] | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "directory-menu"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
10 changes: 5 additions & 5 deletions
10
react-context-api/src/components/form-input/form-input.component.jsx
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
25 changes: 25 additions & 0 deletions
25
react-context-api/src/components/form-input/form-item.component.test.js
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,25 @@ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import FormInput from "./form-input.component"; | ||
import { findByDataAttr } from "../../utils/utils"; | ||
|
||
const setUp = (props = {}) => { | ||
const component = shallow(<FormInput {...props}></FormInput>); | ||
return component; | ||
}; | ||
|
||
describe("CartDropdown Component", () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
const props = { | ||
label: "", | ||
handleChange: jest.fn() | ||
}; | ||
wrapper = setUp(props); | ||
}); | ||
|
||
it("should render without error", () => { | ||
const component = findByDataAttr(wrapper, "form-input"); | ||
expect(component.length).toBe(1); | ||
}); | ||
}); |
Oops, something went wrong.