-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.js
More file actions
26 lines (20 loc) · 700 Bytes
/
test.js
File metadata and controls
26 lines (20 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
require('mocha');
var fs = require('fs');
var assert = require('assert');
var strip = require('./');
describe('strip-bom-buffer', function() {
it('should strip bom:', function() {
assert.deepEqual(strip(new Buffer('\ufefffoo')).toString(), 'foo');
});
it('should return a non-buffer value', function() {
assert.deepEqual(strip('foo'), 'foo');
assert.deepEqual(strip({}), {});
});
it('returns a non-utf8 value', function() {
var utf16be = fs.readFileSync('./fixtures/bom-utf16be.txt');
var utf16le = fs.readFileSync('./fixtures/bom-utf16le.txt');
assert.deepEqual(strip(utf16be), utf16be);
assert.deepEqual(strip(utf16le), utf16le);
});
});