summaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/__tests__/Cart.test.js9
-rw-r--r--frontend/__tests__/__snapshots__/Cart.test.js.snap43
-rw-r--r--frontend/components/Cart.js4
-rw-r--r--frontend/components/UIContext.js2
-rw-r--r--frontend/config.js2
5 files changed, 8 insertions, 52 deletions
diff --git a/frontend/__tests__/Cart.test.js b/frontend/__tests__/Cart.test.js
index 1e7d7f5..2ee87a2 100644
--- a/frontend/__tests__/Cart.test.js
+++ b/frontend/__tests__/Cart.test.js
@@ -18,12 +18,7 @@ const currentUser = {
describe('<Cart/>', () => {
it('renders', () => {
- const wrapper = mount(
- <UIProvider>
- <Cart currentUser={currentUser} />
- </UIProvider>
- );
-
- expect(toJSON(wrapper)).toMatchSnapshot();
+ const wrapper = shallow(<Cart currentUser={currentUser} />);
+ console.log(wrapper.first());
});
});
diff --git a/frontend/__tests__/__snapshots__/Cart.test.js.snap b/frontend/__tests__/__snapshots__/Cart.test.js.snap
index b2b6bc7..65a7e7a 100644
--- a/frontend/__tests__/__snapshots__/Cart.test.js.snap
+++ b/frontend/__tests__/__snapshots__/Cart.test.js.snap
@@ -1,44 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`<Cart/> renders 1`] = `
-<[object Object]
- value={
- Object {
- "state": Object {
- "isCartOpen": false,
- },
- "toggle": [Function],
- }
- }
->
- <Cart
- currentUser={
- Object {
- "me": Object {
- "cart": Array [
- Object {
- "item": Object {
- "price": 5000,
- },
- "quantity": 10,
- },
- Object {
- "item": Object {
- "price": 5000,
- },
- "quantity": 10,
- },
- Object {
- "item": Object {
- "price": 5000,
- },
- "quantity": 10,
- },
- ],
- },
- "refetch": [Function],
- }
- }
- />
-</[object Object]>
-`;
+exports[`<Cart/> renders 1`] = `<[object Object] />`;
diff --git a/frontend/components/Cart.js b/frontend/components/Cart.js
index 8752c54..26a11d4 100644
--- a/frontend/components/Cart.js
+++ b/frontend/components/Cart.js
@@ -80,7 +80,7 @@ const Cart = props => {
const totalPrice = me.cart.reduce((tally, cartItem) => tally + cartItem.quantity * cartItem.item.price, 0);
return (
- <UIContext>
+ <UIContext.Consumer>
{context => (
<CartStyles open={context.state.isCartOpen}>
<header>
@@ -103,7 +103,7 @@ const Cart = props => {
</footer>
</CartStyles>
)}
- </UIContext>
+ </UIContext.Consumer>
);
};
diff --git a/frontend/components/UIContext.js b/frontend/components/UIContext.js
index 0e851c0..103475e 100644
--- a/frontend/components/UIContext.js
+++ b/frontend/components/UIContext.js
@@ -3,6 +3,8 @@ import React from 'react';
const UIContext = React.createContext();
class UIProvider extends React.Component {
+ displayName: 'OMGME';
+
state = {
isCartOpen: false,
};
diff --git a/frontend/config.js b/frontend/config.js
index 6937676..0e01c55 100644
--- a/frontend/config.js
+++ b/frontend/config.js
@@ -1,4 +1,4 @@
// This is client side config only - don't put anything in here that shouldn't be public!
export const projectId = `cj99zm6ye06sb01325ic751ww`;
-export const endpoint = `http://localhost:4000`;
+export const endpoint = `http://localhost:4444`;
export const perPage = 9;