Ranger 19e3488efc
fix(napi): JsString should respect \0 character to align with String (#2138)
* fix(napi): JsString should respect \0 character to align with String

* chore(test): update snapshot
2024-06-12 15:20:27 +08:00

29 lines
796 B
TypeScript

import test from 'ava'
const bindings = require('../index.node')
test('should be able to concat string', (t) => {
const fixture = 'JavaScript 🌳 你好 napi'
t.snapshot(bindings.concatString(fixture))
})
test('should be able to concat string with char \0', (t) => {
const fixture = 'JavaScript \0 🌳 你好 \0 napi'
t.snapshot(fixture)
t.snapshot(bindings.concatString(fixture))
})
test('should be able to concat utf16 string', (t) => {
const fixture = 'JavaScript 🌳 你好 napi'
t.snapshot(bindings.concatUTF16String(fixture))
})
test('should be able to concat latin1 string', (t) => {
const fixture = 'æ¶½¾DEL'
t.snapshot(bindings.concatLatin1String(fixture))
})
test('should be able to crate latin1 string', (t) => {
t.snapshot(bindings.createLatin1())
})