-
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.
feat(): add sample files for auto-generated files
[Delivers #29]
- Loading branch information
Inumidun Amao
committed
Jun 13, 2017
1 parent
fd3bc3d
commit a2ffea8
Showing
25 changed files
with
316 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"presets": [ | ||
"react", | ||
"es2015", | ||
"stage-2" | ||
], | ||
"plugins": [ | ||
"transform-object-rest-spread", | ||
"transform-decorators-legacy" | ||
] | ||
} |
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
File renamed without changes.
File renamed without changes.
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'; | ||
|
||
/** | ||
* About page view | ||
* @class About | ||
* @extends {React.Component} | ||
*/ | ||
class About extends React.Component { | ||
|
||
/** | ||
* Renders the view of the component | ||
* @returns {Object} react component to render | ||
* @memberOf About | ||
*/ | ||
render() { | ||
return ( | ||
<h2>About page</h2> | ||
); | ||
} | ||
} | ||
|
||
export default About; |
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,13 @@ | ||
/* global expect:true */ | ||
/* global shallow:true */ | ||
|
||
import React from 'react';//eslint-disable-line | ||
|
||
import About from '../../src/components/static/About.component'; | ||
|
||
describe('<About />', () => { | ||
it('should have a div', () => { | ||
const wrapper = shallow(<About />); | ||
expect(wrapper.find('div')).to.have.length(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
|
||
/** | ||
* Component to persist across all routes | ||
* @class Common | ||
* @extends {React.Component} | ||
*/ | ||
class Common extends React.Component { | ||
|
||
/** | ||
* Renders the view of the component | ||
* @returns {Object} react component to render | ||
* @memberOf Common | ||
*/ | ||
render() { | ||
return ( | ||
<div> | ||
<nav> | ||
<h2>Navbar</h2> | ||
</nav> | ||
{this.props.children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Common; |
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,13 @@ | ||
/* global expect:true */ | ||
/* global shallow:true */ | ||
|
||
import React from 'react';//eslint-disable-line | ||
|
||
import Common from '../../src/components/common/Common.component'; | ||
|
||
describe('<Common />', () => { | ||
it('should have a Nav', () => { | ||
const wrapper = shallow(<Common />); | ||
expect(wrapper.find('nav')).to.have.length(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
|
||
/** | ||
* Home page view | ||
* @class Home | ||
* @extends {React.Component} | ||
*/ | ||
class Home extends React.Component { | ||
|
||
/** | ||
* Renders the view of the component | ||
* @returns {Object} react component to render | ||
* @memberOf Home | ||
*/ | ||
render() { | ||
return ( | ||
<h2>Home page</h2> | ||
); | ||
} | ||
} | ||
|
||
export default Home; |
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,16 @@ | ||
/* global expect:true */ | ||
/* global shallow:true */ | ||
/* global mount:true */ | ||
|
||
import React from 'react';//eslint-disable-line | ||
|
||
import Home from '../../src/components/Home.component'; | ||
|
||
describe('<Home />', () => { | ||
it('should have a heading text', () => { | ||
const wrapper = shallow( | ||
<Home /> | ||
); | ||
expect(wrapper.find('.heading')).to.have.length(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { Router, Route, IndexRoute, browserHistory } from 'react-router'; | ||
import Common from './common/Common.component'; | ||
import Home from './Home.component'; | ||
import About from './static/About.component'; | ||
|
||
const routes = ( | ||
<Route path="/" component={Common}> | ||
<IndexRoute component={Home} /> | ||
<Route path="/about" component={About} /> | ||
</Route> | ||
); | ||
|
||
|
||
/** | ||
* Declare and define all routes in the application | ||
* @class Routes | ||
* @extends {React.Component} | ||
*/ | ||
class Routes extends React.Component { | ||
|
||
/** | ||
* Renders the view of the component | ||
* @returns {Object} react component to render | ||
* @memberOf Routes | ||
*/ | ||
render() { | ||
return ( | ||
<Router history={browserHistory} routes={routes} /> | ||
); | ||
} | ||
} | ||
|
||
export default Routes; |
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 @@ | ||
export default { | ||
|
||
} |
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,7 @@ | ||
import actionTypes from '../../src/actions/actionTypes'; | ||
|
||
describe('actionTypes', () => { | ||
it('should return an object of actions', () => { | ||
expect(actionTypes).to.be.an.object; | ||
}); | ||
}); |
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 @@ | ||
// write e2e tests here |
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,45 @@ | ||
import axios from 'axios'; | ||
|
||
/** | ||
* Set the a value inside localStorage | ||
* @export | ||
* @param {String} key - key to store value with in localStorage | ||
* @param {String} value - item to store inside localStorage | ||
* @returns {Promise} returns a promise and resolves it with the stored value | ||
*/ | ||
export function setLocalstorage(key, value) { | ||
let storedValue; | ||
return new Promise((resolve) => { | ||
window.localStorage.setItem(key, value); | ||
storedValue = window.localStorage.getItem(key); | ||
if (storedValue) { | ||
resolve(storedValue); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* set a default header in axios | ||
* @export | ||
* @param {String} header - header name to set | ||
* @param {String} value - value to set header as | ||
* @returns {Void} does not have a return value | ||
*/ | ||
export function setDefaultHeader(header, value) { | ||
axios.defaults.headers.common.Authorization = value; | ||
} | ||
|
||
|
||
/** | ||
* clear or remove one or all items from localStorage | ||
* @export | ||
* @param {String} key - item to remove in localStorage | ||
* @returns {Void} does not have a return value | ||
*/ | ||
export function clearStorage(key) { | ||
if (!key) { | ||
window.localStorage.clear(); | ||
} else { | ||
window.localStorage.removeItem(key); | ||
} | ||
} |
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 @@ | ||
All images will be stored in this folder |
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>(title)</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="/bundle.js"></script> | ||
</body> | ||
</html> |
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,16 @@ | ||
import React from 'react'; | ||
import ReactDom from 'react-dom'; | ||
import { Provider } from 'react-redux'; | ||
import store from './store'; | ||
import Routes from './components/Routes.component'; | ||
|
||
require('./sass/style.scss'); | ||
require('./sass/style.less'); | ||
|
||
|
||
ReactDom.render( | ||
<Provider store={store}> | ||
<Routes /> | ||
</Provider>, | ||
document.getElementById('app') | ||
); |
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,44 @@ | ||
import { jsdom } from 'jsdom'; //eslint-disable-line | ||
import configureMockStore from 'redux-mock-store'; | ||
import thunk from 'redux-thunk'; | ||
import nock from 'nock'; | ||
import faker from 'faker'; | ||
import * as chai from 'chai'; | ||
import spies from 'chai-spies'; | ||
import sinon from 'sinon'; | ||
import moxios from 'moxios'; | ||
import { mount, shallow, render } from 'enzyme'; | ||
|
||
const exposedProperties = ['window', 'navigator', 'document']; | ||
|
||
global.document = jsdom(''); | ||
global.window = document.defaultView; | ||
Object.keys(document.defaultView).forEach((property) => { | ||
if (typeof global[property] === 'undefined') { | ||
exposedProperties.push(property); | ||
global[property] = document.defaultView[property]; | ||
} | ||
}); | ||
|
||
chai.use(spies); | ||
|
||
global.window.localStorage = { | ||
getItem: () => { | ||
return 'abc'; | ||
} | ||
} | ||
|
||
global.sinon = sinon; | ||
global.expect = chai.expect; | ||
global.thunk = thunk; | ||
global.configureMockStore = configureMockStore; | ||
global.nock = nock; | ||
global.mount = mount; | ||
global.shallow = shallow; | ||
global.render = render; | ||
global.spy = spies; | ||
global.faker = faker; | ||
global.moxios = moxios; | ||
global.navigator = { | ||
userAgent: 'node.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,8 @@ | ||
import { combineReducers } from 'redux'; | ||
import reduceReducers from 'reduce-reducers'; | ||
|
||
const combinedReducers = combineReducers({ | ||
|
||
}); | ||
|
||
export default reduceReducers(combinedReducers); |
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 @@ | ||
describe('Root Reducer', () => { | ||
|
||
}); |
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 @@ | ||
// This is a custom javascript file |
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 { applyMiddleware, createStore, compose } from 'redux'; | ||
import thunk from 'redux-thunk'; | ||
import reducers from './reducers/root.reducer'; | ||
|
||
const middleware = [thunk]; | ||
|
||
const finalCreateStore = compose( | ||
applyMiddleware(...middleware) | ||
)(createStore); | ||
|
||
export default finalCreateStore(reducers); |
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 @@ | ||
body { | ||
margin: auto; | ||
} |
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 @@ | ||
All vendors will be placed in this directory |