summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/FINISHED/frontend/lib/testUtils.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-09-14 12:18:12 -0400
committerWes Bos <wesbos@gmail.com>2018-09-14 12:18:12 -0400
commit2d145b026cfdf54a63bef0b9d6324b6785390307 (patch)
treef6c1d8f987437803a5c026e70535bf9ff244e885 /stepped-solutions/FINISHED/frontend/lib/testUtils.js
parent8a5825d52271d712ec7c8348447d433067e13ef2 (diff)
move finished folder
Diffstat (limited to 'stepped-solutions/FINISHED/frontend/lib/testUtils.js')
-rw-r--r--stepped-solutions/FINISHED/frontend/lib/testUtils.js79
1 files changed, 0 insertions, 79 deletions
diff --git a/stepped-solutions/FINISHED/frontend/lib/testUtils.js b/stepped-solutions/FINISHED/frontend/lib/testUtils.js
deleted file mode 100644
index 42739e9..0000000
--- a/stepped-solutions/FINISHED/frontend/lib/testUtils.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import casual from 'casual';
-
-// seed it so we get consistent results
-casual.seed(777);
-
-const fakeItem = () => ({
- __typename: 'Item',
- id: '123',
- price: 5000,
- user: null,
- image: 'dog-small.jpg',
- title: 'dogs are best',
- description: 'dogs',
- largeImage: 'dog.jpg',
-});
-
-const fakeUser = () => ({
- __typename: 'User',
- id: '4234',
- name: casual.name,
- email: casual.email,
- permissions: ['ADMIN'],
- orders: [],
- cart: [],
-});
-
-const fakeOrderItem = () => ({
- __typename: 'OrderItem',
- id: casual.uuid,
- image: `${casual.word}.jpg`,
- title: casual.words(),
- price: 4234,
- quantity: 1,
- description: casual.words(),
-});
-
-const fakeOrder = () => ({
- __typename: 'Order',
- id: 'ord123',
- charge: 'ch_123',
- total: 40000,
- items: [fakeOrderItem(), fakeOrderItem()],
- createdAt: '2018-04 - 06T19: 24: 16.000Z',
- user: fakeUser(),
-});
-
-const fakeCartItem = overrides => ({
- __typename: 'CartItem',
- id: 'omg123',
- quantity: 3,
- item: fakeItem(),
- user: fakeUser(),
- ...overrides,
-});
-
-// Fake LocalStorage
-class LocalStorageMock {
- constructor() {
- this.store = {};
- }
-
- clear() {
- this.store = {};
- }
-
- getItem(key) {
- return this.store[key] || null;
- }
-
- setItem(key, value) {
- this.store[key] = value.toString();
- }
-
- removeItem(key) {
- delete this.store[key];
- }
-}
-
-export { LocalStorageMock, fakeItem, fakeUser, fakeCartItem, fakeOrder, fakeOrderItem };