/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/removeBOM.unittest.js
23 строки
656 B
Alexander Akait
test: add unit coverage for util helpers and parser edge branches, drop integration-covered unit tests (#21512)
26 июл 2026, 15:52
Не верифицирован
26 июл 2026, 15:52
3e913cc
Код
Авторство
О чём код?
"use strict"; const removeBOM = require("../lib/util/removeBOM"); describe("removeBOM", () => { it("should strip a leading BOM from a string", () => { expect(removeBOM("hi")).toBe("hi"); }); it("should leave a string without a BOM untouched", () => { expect(removeBOM("hi")).toBe("hi"); }); it("should strip a leading UTF-8 BOM from a buffer", () => { const result = removeBOM(Buffer.from([0xef, 0xbb, 0xbf, 65, 66])); expect(/** @type {Buffer} */ (result).toString()).toBe("AB"); }); it("should leave a buffer without a BOM untouched", () => { const input = Buffer.from([65, 66]); expect(removeBOM(input)).toBe(input); }); });