File: test.js

package info (click to toggle)
node-vinyl-fs 3.0.3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,884 kB
  • sloc: makefile: 43; sh: 43
file content (26 lines) | stat: -rw-r--r-- 700 bytes parent folder | download | duplicates (2)
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
26
'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);
  });
});