From 7beb6131b8aa34e2abeceec50c18d228b66c4b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Volek?= Date: Mon, 30 Jul 2018 14:17:49 +0200 Subject: [PATCH] Added test snapshot and updated coverage --- jest.config.js | 4 ++++ .../__tests__/__snapshots__/ethUtils.test.js.snap | 10 +++++++++- src/js/utils/__tests__/ethUtils.test.js | 10 ++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/jest.config.js b/jest.config.js index 99c9bb43..6b9dcaaa 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,8 +1,12 @@ module.exports = { + rootDir: './src', collectCoverage: true, testURL: 'http://localhost', modulePathIgnorePatterns: [ 'node_modules', ], + collectCoverageFrom: [ + 'js/utils/**.js', + ], }; diff --git a/src/js/utils/__tests__/__snapshots__/ethUtils.test.js.snap b/src/js/utils/__tests__/__snapshots__/ethUtils.test.js.snap index 02b9dc6e..0ffd930d 100644 --- a/src/js/utils/__tests__/__snapshots__/ethUtils.test.js.snap +++ b/src/js/utils/__tests__/__snapshots__/ethUtils.test.js.snap @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`sds decimalToHex 1`] = `2`; +exports[`eth utils decimalToHex 1`] = `"0"`; + +exports[`eth utils decimalToHex 2`] = `"1"`; + +exports[`eth utils decimalToHex 3`] = `"2"`; + +exports[`eth utils decimalToHex 4`] = `"64"`; + +exports[`eth utils decimalToHex 5`] = `"3e7"`; diff --git a/src/js/utils/__tests__/ethUtils.test.js b/src/js/utils/__tests__/ethUtils.test.js index 11dd3791..3ff6e2ea 100644 --- a/src/js/utils/__tests__/ethUtils.test.js +++ b/src/js/utils/__tests__/ethUtils.test.js @@ -1,5 +1,11 @@ -describe('sds', () => { +import * as ethUtils from '../ethUtils'; + +describe('eth utils', () => { it('decimalToHex', () => { - expect(2).toMatchSnapshot(); + const input = [0, 1, 2, 100, 999]; + + input.forEach((entry) => { + expect(ethUtils.decimalToHex(entry)).toMatchSnapshot(); + }); }); });