From 4b30d2dcce9f223aac1fa2a189b8d63b0b374b47 Mon Sep 17 00:00:00 2001 From: Marie <marie.lefort@gmail.com> Date: Fri, 23 Mar 2018 01:47:39 +0100 Subject: [PATCH] refacto test --- main.test.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/main.test.js b/main.test.js index 53826df..c14aae6 100644 --- a/main.test.js +++ b/main.test.js @@ -2,21 +2,12 @@ const data = [ '0.0488','86400','1000','432000','100','5259600','63115200', '5','5259600','5259600','0.8','31557600','5','24','300','12','0.67', '1488970800','1490094000','15778800' ]; const app = require("./main"); -test('app parse c', () => { - expect(app(data).c).toBe(0.0488); -}); -test('app parse dt', () => { - expect(app(data).dt).toBe(86400); -}); -test('app parse ud0', () => { - expect(app(data).ud0).toBe(1000); -}); -test('app parse sigPeriod', () => { - expect(app(data).sigPeriod).toBe(432000); -}); -test('app parse percentRot', () => { - expect(app(data).percentRot).toBe(15778800); -}); -test('app parse txWindow', () => { - expect(app(data).txWindow).toBe("???"); +const expected = { + c:0.0488, dt:86400, ud0:1000, sigPeriod:432000 +} +test('app convert raw data to expected', () => { + const resultat = app(data); + for(let key in expected){ + expect(resultat[key]).toBe(expected[key]); + } }); -- GitLab