Last active
February 9, 2017 23:15
-
-
Save curtiswilkinson/07033b59fd355231f40b7dd329bc9a19 to your computer and use it in GitHub Desktop.
Testing
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 * as sut from './index1' | |
import * as sinon from 'sinon' | |
import { expect } from 'chai' | |
describe('_saveAndProcessPayload', () => { | |
it('will return a formatted API payload', () => { | |
const mockPayload = [ | |
{ name: 'name1', value: 'value1' }, | |
{ name: 'name2', value: 'value2' }, | |
] | |
const apiStub = { save: sinon.stub().returns(mockPayload) } | |
const result = sut._saveAndProcessReturn(apiStub, 'testPayload') | |
const expected = [ | |
{ name1: 'value1' }, | |
{ name2: 'value2' } | |
] | |
expect(result).to.deep.equal(expected) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment