-
Notifications
You must be signed in to change notification settings - Fork 3
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
Brian
committed
Jun 13, 2017
1 parent
2968dc2
commit d9b9bee
Showing
7 changed files
with
212 additions
and
17 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
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,102 @@ | ||
|
||
|
||
|
||
export default function (url,opt){ | ||
return Promise.resolve( { json: ()=>{ | ||
return links[url] | ||
} } ) | ||
} | ||
|
||
const links = {}; | ||
|
||
links[`https://jsonplaceholder.typicode.com/users/1`] = { | ||
"id": 1, | ||
"name": "Sr. Leanne Graham", | ||
"username": "Bret", | ||
"email": "Sincere@april.biz", | ||
"address": { | ||
"street": "Kulas Light", | ||
"suite": "Apt. 556", | ||
"city": "Gwenborough", | ||
"zipcode": "92998-3874", | ||
"geo": { | ||
"lat": "-37.3159", | ||
"lng": "81.1496" | ||
} | ||
}, | ||
"phone": "1-770-736-8031 x56442", | ||
"website": "hildegard.org", | ||
"company": { | ||
"name": "Romaguera-Crona", | ||
"catchPhrase": "Multi-layered client-server neural-net", | ||
"bs": "harness real-time e-markets" | ||
} | ||
} | ||
|
||
links['http://jsonplaceholder.typicode.com/posts'] = [ | ||
{ | ||
"userId": 1, | ||
"id": 1, | ||
"title": "test sunt aut facere repellat provident occaecati excepturi optio reprehenderit", | ||
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 2, | ||
"title": "qui est esse", | ||
"body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 3, | ||
"title": "ea molestias quasi exercitationem repellat qui ipsa sit aut", | ||
"body": "et iusto sed quo iure\nvoluptatem occaecati omnis eligendi aut ad\nvoluptatem doloribus vel accusantium quis pariatur\nmolestiae porro eius odio et labore et velit aut" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 4, | ||
"title": "eum et est occaecati", | ||
"body": "ullam et saepe reiciendis voluptatem adipisci\nsit amet autem assumenda provident rerum culpa\nquis hic commodi nesciunt rem tenetur doloremque ipsam iure\nquis sunt voluptatem rerum illo velit" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 5, | ||
"title": "nesciunt quas odio", | ||
"body": "repudiandae veniam quaerat sunt sed\nalias aut fugiat sit autem sed est\nvoluptatem omnis possimus esse voluptatibus quis\nest aut tenetur dolor neque" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 6, | ||
"title": "dolorem eum magni eos aperiam quia", | ||
"body": "ut aspernatur corporis harum nihil quis provident sequi\nmollitia nobis aliquid molestiae\nperspiciatis et ea nemo ab reprehenderit accusantium quas\nvoluptate dolores velit et doloremque molestiae" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 7, | ||
"title": "magnam facilis autem", | ||
"body": "dolore placeat quibusdam ea quo vitae\nmagni quis enim qui quis quo nemo aut saepe\nquidem repellat excepturi ut quia\nsunt ut sequi eos ea sed quas" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 8, | ||
"title": "dolorem dolore est ipsam", | ||
"body": "dignissimos aperiam dolorem qui eum\nfacilis quibusdam animi sint suscipit qui sint possimus cum\nquaerat magni maiores excepturi\nipsam ut commodi dolor voluptatum modi aut vitae" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 9, | ||
"title": "nesciunt iure omnis dolorem tempora et accusantium", | ||
"body": "consectetur animi nesciunt iure dolore\nenim quia ad\nveniam autem ut quam aut nobis\net est aut quod aut provident voluptas autem voluptas" | ||
}, | ||
{ | ||
"userId": 1, | ||
"id": 10, | ||
"title": "optio molestias id quia eum", | ||
"body": "quo et expedita modi cum officia vel magni\ndoloribus qui repudiandae\nvero nisi sit\nquos veniam quod sed accusamus veritatis error" | ||
}, | ||
{ | ||
"userId": 2, | ||
"id": 11, | ||
"title": "et ea vero quia laudantium autem", | ||
"body": "delectus reiciendis molestiae occaecati non minima eveniet qui voluptatibus\naccusamus in eum beatae sit\nvel qui neque voluptates ut commodi qui incidunt\nut animi commodi" | ||
}] |
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,39 @@ | ||
|
||
import React from 'react' | ||
import Ui from './../index.jsx'; | ||
import {mount, shallow} from 'enzyme' | ||
|
||
import {Provider} from 'react-redux' | ||
import {createStore, applyMiddleware, combineReducers} from 'redux' | ||
|
||
import { auto, reducers } from 'redux-auto'; | ||
|
||
|
||
import fetch from './fetch'; | ||
|
||
global.fetch = fetch | ||
global.console.log = ()=>{} | ||
|
||
|
||
import require_context from './require_context' | ||
|
||
const webpackModules = require_context("../../store", true, /^(?!.*\.test\.js$).*\.js$/); | ||
|
||
// build 'auto' based on target files via Webpack | ||
const middleware = applyMiddleware( auto(webpackModules, webpackModules.keys())) | ||
|
||
const store = createStore(combineReducers(reducers), middleware ) | ||
|
||
// https://medium.com/@gethylgeorge/testing-a-react-redux-app-using-jest-and-enzyme-b349324803a9 | ||
|
||
describe('<Ui/>',()=>{ | ||
|
||
it('renders 1 <Ui/> component', ()=>{ | ||
mount( <Provider store={store}><Ui /></Provider> ) | ||
|
||
}) | ||
|
||
|
||
// https://www.youtube.com/watch?v=u5XTnNBotqs | ||
|
||
}) |
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,33 @@ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
export default function (base = '.', scanSubDirectories = false, regularExpression = /\.js$/) { | ||
const files = {}; | ||
|
||
function readDirectory(directory) { | ||
fs.readdirSync(directory).forEach((file) => { | ||
const fullPath = path.resolve(directory, file); | ||
|
||
if (fs.statSync(fullPath).isDirectory()) { | ||
if (scanSubDirectories) readDirectory(fullPath); | ||
|
||
return; | ||
} | ||
|
||
if (!regularExpression.test(fullPath)) return; | ||
|
||
files[fullPath] = true; | ||
}); | ||
} | ||
|
||
readDirectory(path.resolve(__dirname, base)); | ||
|
||
function Module(file) { | ||
return require(file); | ||
} | ||
|
||
Module.keys = () => Object.keys(files); | ||
|
||
return Module; | ||
}; |
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