node-tar/test/normalize-unicode.js

13 lines
430 B
JavaScript
Raw Normal View History

const t = require('tap')
const normalize = require('../lib/normalize-unicode.js')
// café
const cafe1 = Buffer.from([0x63, 0x61, 0x66, 0xc3, 0xa9]).toString()
// cafe with a `
const cafe2 = Buffer.from([0x63, 0x61, 0x66, 0x65, 0xcc, 0x81]).toString()
t.equal(normalize(cafe1), normalize(cafe2), 'matching unicodes')
t.equal(normalize(cafe1), normalize(cafe2), 'cached')
2024-06-18 15:34:22 +08:00
t.equal(normalize('foo'), 'foo', 'non-unicode string')