mirror of
https://gitlab.silvrtree.co.uk/martind2000/md-utils.git
synced 2025-01-10 22:05:07 +00:00
a6b91770ae
Added tests
57 lines
1.1 KiB
JavaScript
57 lines
1.1 KiB
JavaScript
var $U = require('../lib/md-utils');
|
|
var assert = require('assert');
|
|
|
|
var dashedObj = {
|
|
notdashed: 0,
|
|
'is-dashed': 1,
|
|
'also-dashed': 2
|
|
};
|
|
|
|
var notdashedObj = {
|
|
notdashed: 0,
|
|
isnotdashed: 1,
|
|
alsonotdashed: 2
|
|
};
|
|
|
|
var underScoredObj = {
|
|
notdashed: 0,
|
|
is_dashed: 1,
|
|
also_dashed: 2
|
|
};
|
|
|
|
describe('unDashObject', function() {
|
|
it('converts an object with dashes to underscores ', function(done) {
|
|
|
|
var updateData = $U.unDashObject(dashedObj);
|
|
|
|
assert.deepEqual(updateData, underScoredObj);
|
|
done();
|
|
});
|
|
|
|
it('converts an object with no dashes correctly', function(done) {
|
|
|
|
var updateData = $U.unDashObject(notdashedObj);
|
|
|
|
assert.deepEqual(updateData, notdashedObj);
|
|
done();
|
|
});
|
|
});
|
|
|
|
describe('reDashObject', function() {
|
|
it('converts an object with underscores to dashes ', function(done) {
|
|
|
|
var updateData = $U.reDashObject(underScoredObj);
|
|
|
|
assert.deepEqual(updateData, dashedObj);
|
|
done();
|
|
});
|
|
|
|
it('converts an object with no underscores correctly', function(done) {
|
|
|
|
var updateData = $U.reDashObject(notdashedObj);
|
|
|
|
assert.deepEqual(updateData, notdashedObj);
|
|
done();
|
|
});
|
|
});
|