Skip to content

Commit

Permalink
Add test case for new event serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Blurton committed Apr 21, 2016
1 parent 70a82a6 commit e2ed55e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/client/__tests__/client_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,38 @@ describe('client.ClientApi', () => {
count: 1,
}]);
});

it('should replace any Synthetic Event with it\'s name when not the first argument', () => {
const api = getClientApi();
api._syncedStore.getData = () => ({ actions: [] });
api._syncedStore.setData = sinon.stub();

const event = {
preventDefault() {},
};
const data = {
type: 'delete',
};

const cb = api.action('hello');
cb(data, event);

const args = api._syncedStore.setData.args[0];
const actions = clearActionId(args[0].actions);

expect(actions).to.be.deep.equal([{
data: {
name: 'hello',
args: [
{
type: 'delete',
},
'[SyntheticEvent]',
],
},
count: 1,
}]);
});
});

describe('linkTo', () => {
Expand Down

0 comments on commit e2ed55e

Please sign in to comment.