joyent-portal/packages/unitcalc/test/index.js
Sérgio Ramos 8295bd6882 chore: initial lerna setup
this shall be a progressive process
2017-05-25 10:56:50 +01:00

28 lines
781 B
JavaScript

const test = require('ava');
const unitcalc = require('../');
test('with multiple num arguments', t => {
t.deepEqual(unitcalc(1, 2, 3, 4), '0.375rem 0.75rem 1.125rem 1.5rem');
});
test('with single str argument', t => {
t.deepEqual(unitcalc('1'), '0.375rem');
t.deepEqual(unitcalc.withBase(10, '1'), '0.625rem');
});
test('with multiple str arguments', t => {
t.deepEqual(unitcalc('1', '2', '3', '4'), '0.375rem 0.75rem 1.125rem 1.5rem');
t.deepEqual(
unitcalc.withBase(10, '1', '2', '3', '4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
});
test('with single str argument spaced', t => {
t.deepEqual(unitcalc('1 2 3 4'), '0.375rem 0.75rem 1.125rem 1.5rem');
t.deepEqual(
unitcalc.withBase(10, '1 2 3 4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
});