31 lines
787 B
JavaScript
31 lines
787 B
JavaScript
'use strict';
|
|
|
|
// Tests for extra utilities;
|
|
|
|
const decomment = require('../lib');
|
|
const os = require('os');
|
|
const LB = os.EOL;
|
|
|
|
describe('Utils/Positive:', function () {
|
|
|
|
describe('getEOL', function () {
|
|
expect(decomment.getEOL('')).toBe(LB);
|
|
expect(decomment.getEOL('\nhello')).toBe('\n');
|
|
expect(decomment.getEOL('\r\nhello')).toBe('\r\n');
|
|
expect(decomment.getEOL('\r\nhello\n')).toBe(LB);
|
|
});
|
|
|
|
});
|
|
|
|
describe('Utils/Negative:', function () {
|
|
|
|
describe('getEOL non-string', function () {
|
|
it('must throw an error', function () {
|
|
expect(function () {
|
|
decomment.getEOL();
|
|
}).toThrow(new TypeError('Invalid parameter \'text\' specified.'));
|
|
});
|
|
});
|
|
|
|
});
|