chore(client): Move client app to /client

This commit is contained in:
Bouncey
2018-08-31 12:52:49 +01:00
committed by mrugesh mohapatra
parent 0e4f588a1c
commit e59ad6ebda
172 changed files with 13171 additions and 14 deletions

View File

@@ -1,16 +0,0 @@
import { makeToast } from '../../common/app/Toasts/redux';
export default function flashToToast(flash) {
return Object.keys(flash)
.map(key => {
const messages = flash[key];
return messages.map(message => ({
message: message.msg,
type: key,
timeout: 5000
}));
})
.reduce((toasts, messages) => toasts.concat(messages), [])
.map(makeToast)
.map(({ payload }) => payload);
}

View File

@@ -1,32 +0,0 @@
import test from 'tape';
import flashToToast from './flash-to-toast';
test('client/utils/flash-to-toast.js', t => {
t.test('should return an array', t => {
t.plan(2);
const toasts = flashToToast({});
t.assert(Array.isArray(toasts), 'toasts was not an array');
t.equal(toasts.length, 0, 'toasts should be empty');
});
t.test('should convert keyed messages to typed toasts', t => {
t.plan(3);
const expected = [{ message: 'foo', type: 'info' }];
const actual = flashToToast({
info: [{ msg: 'foo' }]
});
t.equal(
expected.length,
actual.length,
'number of toasts does not match number of messages'
);
t.equal(
expected[0].type,
actual[0].type
);
t.equal(
expected[0].message,
actual[0].message
);
});
});

View File

@@ -1,6 +0,0 @@
export default function sendPageAnalytics(history, ga) {
history.listen(location => {
ga('set', 'page', location.pathname + location.search);
ga('send', 'pageview');
});
}