md-utils/test/md-utils.js
martind2000 a6b91770ae 0.0.3
Added tests
2016-04-10 11:45:44 +01:00

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();
});
});