1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 16:13:18 +00:00
musix-oss/node_modules/snakeize/test/snakeize.js
2020-03-03 22:30:50 +02:00

37 lines
762 B
JavaScript

var test = require('tape');
var snakeize = require('../');
var obj = {
feeFieFoe: 'fum',
beepBoop: [
{ 'abcXyz': 'mno' },
{ 'FooBar': 'baz' },
{ 'CheeseID': 'wensleydale' }
]
};
test('snakeize a nested object', function (t) {
t.plan(1);
var res = snakeize(obj);
t.deepEqual(res, {
"fee_fie_foe": "fum",
"beep_boop": [
{ "abc_xyz": "mno" },
{ "foo_bar": "baz" },
{ "cheese_id": "wensleydale" }
]
});
});
test('date object is not modified', function (t) {
t.plan(1);
var d = new Date();
t.equal(snakeize(d), d);
});
test('regex object is not modified', function (t) {
t.plan(1);
var r = /1234/;
t.equal(snakeize(r), r);
});