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
expect(response.data.headline).toEqual(‘Document #12–1332–11’); | |
expect(response.data.address.city).toEqual(‘Berlin’); | |
expect(response.data[0].line[0].total).toEqual(101); | |
expect(response.data[0].line[1].total).toEqual(102); | |
expect(response.data[0].line[2].total).toEqual(103); | |
expect(response.data[0].line[3].total).toEqual(104); | |
expect(response.data[1].line[0].total).toEqual(105); | |
expect(response.data[1].line[1].total).toEqual(106); | |
expect(response.data[1].line[2].total).toEqual(107); | |
expect(response.data[1].line[3].total).toEqual(108); |
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
/* eslint prefer-arrow-callback: 0 */ | |
import expect from 'expect'; | |
import moment from 'moment'; | |
import timekeeper from 'timekeeper'; | |
import beautify from 'js-beautify'; | |
import * as apiUtils from '../../../helpers/api'; | |
import * as serverUtils from '../../../helpers/server'; | |
import * as mongoUtils from '../../../helpers/mongo'; |
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
export function trackable(action, event, properties = {}) { | |
const analytics = { | |
eventType: event, | |
eventPayload: properties | |
}; | |
return { ...action, meta: { analytics } }; | |
} |
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
import constants from '../../constants'; | |
export function loadedDashboardState(website, status, news, revenues) { | |
return trackable({ | |
type: constants.DASHBOARD_STATE_LOADED, | |
payload: { website, status, news, revenues } | |
}, | |
'Dashboard opened', // <- event name | |
{ name: website.name } // <- additional event data | |
); |
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
import { createStore, applyMiddleware } from 'redux'; | |
import { createAnalytics } from '../middleware'; | |
const middlewares = [ | |
thunk, | |
createLogger(), | |
createAnalytics({ host: 'ANALYTICS_HOST', token: 'ANALYTICS_TOKEN' }) | |
]; | |
const enchancer = applyMiddleware(...middlewares); |
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
import { client } from '../analytics'; | |
const handleAction = (store, next, action, options) => { | |
if (!action.meta || !action.meta.analytics) { | |
return next(action); | |
} | |
const { eventType, eventPayload } = action.meta.analytics; | |
client(options).track(eventType, eventPayload); |
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
import { createConstants } from '../utils'; | |
const constants = createConstants( | |
// account actions | |
'ACCOUNT_FORM_RESET', | |
'ACCOUNT_FORM_CHANGE', | |
'ACCOUNT_FORM_ERRORS', | |
'ACCOUNT_FORM_ERRORS_CLEAN', | |
'ACCOUNT_ACCESS_TOKEN_FETCHING', | |
'ACCOUNT_ACCESS_TOKEN_FETCHED', |
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
export function composeComponents(component, wrappers = []) { | |
return wrappers.reduce((c, wrapper) => wrapper(c), component); | |
} |
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
const CheckedWelcome = composeComponents( | |
Welcome, | |
[ | |
(c) => checkBoarded(c, { withValue: true, redirectTo: '/app/dashboard' }), | |
(c) => requiresAuth(c) | |
] | |
); | |
const CheckApp = composeComponents( | |
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
const routes = ( | |
<Route path=""> | |
<Route path="/signup" component={SignUp} /> | |
<Route path="/signin" component={SignIn} /> | |
// applied here.. | |
<Route path="/welcome-on-board" component={checkBoarded(Welcome, { withValue: true, redirectTo: '/app/dashboard'}) } /> | |
<Route path="/forgot-password" component={ForgotPassword} /> | |
<Route path="/signout" component={SignOut} /> |