Skip to content

Commit

Permalink
Removes sinon from saved objects unit tests. (elastic#32045)
Browse files Browse the repository at this point in the history
* Removes sinon from saved objects unit tests.

* Uses mockResolvedValue for return values as promises.
  • Loading branch information
njd5475 committed Feb 27, 2019
1 parent 0c4ea5b commit 4ca9a7f
Show file tree
Hide file tree
Showing 18 changed files with 600 additions and 669 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import _ from 'lodash';
import sinon from 'sinon';
import { RawSavedObjectDoc } from '../../serialization';
import { DocumentMigrator } from './document_migrator';

Expand All @@ -28,7 +27,7 @@ describe('DocumentMigrator', () => {
kibanaVersion: '25.2.3',
migrations: {},
validateDoc: _.noop,
log: sinon.spy(),
log: jest.fn(),
};
}

Expand Down Expand Up @@ -475,7 +474,7 @@ describe('DocumentMigrator', () => {
});

it('logs the document and transform that failed', () => {
const log = sinon.spy();
const log = jest.fn();
const migrator = new DocumentMigrator({
...testOpts(),
migrations: {
Expand All @@ -498,7 +497,7 @@ describe('DocumentMigrator', () => {
expect('Did not throw').toEqual('But it should have!');
} catch (error) {
expect(error.message).toMatch(/Dang diggity!/);
const warning = log.args.filter(([[level]]) => level === 'warning')[0][1];
const warning = log.mock.calls.filter(([[level]]) => level === 'warning')[0][1];
expect(warning).toContain(JSON.stringify(failedDoc));
expect(warning).toContain('dog:1.2.3');
}
Expand Down
Loading

0 comments on commit 4ca9a7f

Please sign in to comment.