1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-10 21:30:06 +02:00
copilot/packages/unitcalc/test/index.js

28 lines
781 B
JavaScript
Raw Normal View History

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'
);
});