File: test.js

package info (click to toggle)
node-camelcase-keys 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 100 kB
  • sloc: makefile: 2; sh: 2
file content (19 lines) | stat: -rw-r--r-- 508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import test from 'ava';
import m from './';

test('main', t => {
	t.true(m({'foo-bar': true}).fooBar);
});

test('exclude option', t => {
	t.true(m({'--': true}, {exclude: ['--']})['--']);
	t.deepEqual(m({'foo-bar': true}, {exclude: [/^f/]}), {'foo-bar': true});
});

test('deep option', t => {
	t.deepEqual(
		// eslint-disable-next-line camelcase
		m({foo_bar: true, obj: {one_two: false, arr: [{three_four: true}]}}, {deep: true}),
		{fooBar: true, obj: {oneTwo: false, arr: [{threeFour: true}]}}
	);
});