From d626b31e7a9ee09774ddc216430b446087b8bacf Mon Sep 17 00:00:00 2001 From: Matteo Basso Date: Wed, 6 Jul 2016 22:29:05 +0200 Subject: [PATCH] Fix tests --- package.json | 1 + test/index.spec.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6fa7708..386eb0b 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "babel-plugin-transform-es3-member-expression-literals": "6.8.0", "babel-plugin-transform-es3-property-literals": "6.8.0", "babel-plugin-transform-object-rest-spread": "6.8.0", + "babel-plugin-transform-es2015-modules-commonjs": "6.3.13", "babel-preset-es2015": "6.5.0", "babel-preset-stage-0": "6.5.0", "babel-register": "6.9.0", diff --git a/test/index.spec.js b/test/index.spec.js index 6bc1e7d..6a12799 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -48,7 +48,11 @@ describe('Refraction', () => { global.performance = {}; refraction.addToHistory('testChannel', { value: 'foo' }); const history = refraction.getHistory(); - expect(history[history.length - 1]).toMatch({ + if (history[history.length - 1].time) { + expect(history[history.length - 1].time).toMatch(/\d+.\d{0,}/); + } + delete history[history.length - 1].time; + expect(history[history.length - 1]).toEqual({ channel: 'testChannel', param: { value: 'foo', @@ -113,7 +117,11 @@ describe('Refraction', () => { refraction.addToHistory('testChannel', { value: 'foo' }); const history = refraction.getHistory(); expect(Array.isArray(history)).toEqual(true); - expect(history[0]).toMatch({ + if (history[0].time) { + expect(history[0].time).toMatch(/\d+.\d{0,}/); + } + delete history[0].time; + expect(history[0]).toEqual({ channel: 'testChannel', param: { value: 'foo',