1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 22:33:17 +00:00
musix-oss/node_modules/snakeize/test/snakeize.js

37 lines
762 B
JavaScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
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);
});