1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 22:20:06 +02:00
copilot/packages/remcalc/test/index.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-06-16 23:46:36 +03:00
const test = require('ava');
const remcalc = require('../');
test('with multiple num arguments', t => {
t.deepEqual(remcalc(1, 2, 3, 4), '0.0625rem 0.125rem 0.1875rem 0.25rem');
t.deepEqual(remcalc.withBase(10, 1, 2, 3, 4), '0.1rem 0.2rem 0.3rem 0.4rem');
});
test('with single str argument', t => {
t.deepEqual(remcalc('1'), '0.0625rem');
t.deepEqual(remcalc('1px'), '0.0625rem');
t.deepEqual(remcalc.withBase(10, '1px'), '0.1rem');
});
test('with multiple str arguments', t => {
t.deepEqual(
remcalc('1', '2', '3', '4'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
t.deepEqual(
remcalc('1px', '2px', '3px', '4px'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
t.deepEqual(
remcalc.withBase(10, '1', '2', '3', '4'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
t.deepEqual(
remcalc.withBase(10, '1px', '2px', '3px', '4px'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
});
test('with single str argument spaced', t => {
t.deepEqual(remcalc('1 2 3 4'), '0.0625rem 0.125rem 0.1875rem 0.25rem');
t.deepEqual(remcalc.withBase(10, '1 2 3 4'), '0.1rem 0.2rem 0.3rem 0.4rem');
});