Coverage: up to 24.52

This commit is contained in:
Jeronimo Vallelunga 2017-07-13 10:34:45 -03:00
parent a07e662d43
commit 0968756dd9
6 changed files with 32 additions and 20 deletions

View File

@ -27,4 +27,4 @@ deploy:
on:
branch: master
after_success:
- npm run test:coverage && bash <(curl -s https://codecov.io/bash) -e TRAVIS_NODE_VERSION
- npm run test:coverage && codecov -t $CODECOV_TOKEN

View File

@ -16,9 +16,7 @@ console.log(dummy());
# TODO
- dotenv
- bundlesize
- Prepack
- redux-observable
- Badges: ci, coverage, npm
- https://greenkeeper.io/

View File

@ -30,23 +30,28 @@ test('syncState', () => {
});
});
// test('connectStore', () => {
// const { connectStore } = Actions(central, TYPES);
// expect.assertions(6);
test('connectStore', () => {
const { connectStore } = Actions(central, TYPES);
expect.assertions(8);
// const promise = connectStore('mockName')(dispatch).then(() => {
// expect(central.connect).toBeCalled();
// expect(central.handler).toBeCalled();
const promise = connectStore('mockName')(dispatch).then(() => {
expect(central.connect).toBeCalled();
expect(central.handler).toBeCalled();
// expect(dispatch.mock.calls.length).toBe(2);
// expect(dispatch.mock.calls[0][0]).toEqual({ type: TYPES.BLUETOOTH_CONNECTING });
// expect(dispatch.mock.calls[1][0]).toEqual({ type: TYPES.BLUETOOTH_CONNECTED });
expect(dispatch.mock.calls.length).toBe(3);
expect(dispatch.mock.calls[0][0]).toEqual({ type: TYPES.BLUETOOTH_CONNECTING });
expect(dispatch.mock.calls[1][0]).toEqual({ type: TYPES.BLUETOOTH_CONNECTED });
// return true;
// });
return dispatch.mock.calls[2][0](dispatch); // syncStore
}).then(() => {
expect(central.read).toBeCalled();
expect(dispatch.mock.calls[3][0]).toEqual({ type: TYPES.BLUETOOTH_SYNC, payload: 'mockState' });
// return expect(promise).resolves.toBe(true);
// });
return true;
});
return expect(promise).resolves.toBe(true);
});
test('syncStore', () => {
const { syncStore } = Actions(central, TYPES);

View File

@ -1,9 +1,7 @@
import * as TYPES from '../actions/types';
import * as STATUS from '../central/status';
const initial = {
status: STATUS.INIT,
};
import initial from './initial';
export default (autosync = true) => (state = initial, { type, payload }) => {
switch (type) {

View File

@ -0,0 +1,11 @@
/* global jest, beforeEach, afterEach, test, expect */
import Reducer from '.';
test('type: UNKNOWN', () => {
const reducer = Reducer();
const originalState = { };
const nextState = reducer(originalState, { type: 'UNKNOWN' });
return expect(nextState).toBe(originalState);
});

View File