From ce81f7ea2918dd1065778c2aa4489df3c742b078 Mon Sep 17 00:00:00 2001 From: Amio Date: Sun, 1 Jul 2018 16:19:07 +0800 Subject: [PATCH] Update tests --- test/calc-text-width.spec.js | 5 ++--- test/index.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/calc-text-width.spec.js b/test/calc-text-width.spec.js index 24557fd..c5a58fe 100644 --- a/test/calc-text-width.spec.js +++ b/test/calc-text-width.spec.js @@ -3,8 +3,7 @@ const { Arial12 } = require('../lib/calc-text-width.js') tap.test('calc width for "npm"', t => { t.ok(typeof Arial12 === 'function', 'export function: Arial12') - t.ok(Number.isFinite(Arial12('npm')), 'result is number') - t.ok(Arial12('npm') > 0, 'result is positive number') - t.ok(Arial12('npm') === 24.543750000000003, 'result is correct value') + t.ok(Number.isFinite(Arial12('npm')), 'result is a number') + t.is(Arial12('npm'), 24.6, 'result is correct value') t.end() }) diff --git a/test/index.spec.js b/test/index.spec.js index 3a835dd..c5b2663 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -3,12 +3,12 @@ const badgen = require('..') tap.test('generate badge with { subject, status }', t => { const svg = badgen({ subject: 'npm', status: 'v1.0.0' }) - t.ok(typeof svg === 'string', 'generate without error') + t.ok(typeof svg === 'string', 'successfully generated') t.end() }) tap.test('generate badge with { subject, status, color }', t => { const svg = badgen({ subject: 'npm', status: 'v1.0.0', color: 'ADF' }) - t.ok(typeof svg === 'string', 'generate without error') + t.ok(typeof svg === 'string', 'successfully generated') t.end() })