We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31e94a6 commit bbb9763Copy full SHA for bbb9763
test/text-codec.spec.js
@@ -0,0 +1,32 @@
1
+'use strict'
2
+
3
+/* eslint-env mocha */
4
+const { expect } = require('aegir/utils/chai')
5
+const TextEncoder = require('../src/text-encoder')
6
+const TextDecoder = require('../src/text-decoder')
7
8
+describe('text encode/decode', () => {
9
+ const data = Uint8Array.from([
10
+ 104,
11
+ 101,
12
+ 108,
13
14
+ 111,
15
+ 32,
16
+ 119,
17
18
+ 114,
19
20
+ 100
21
+ ])
22
23
+ it('can encode text', () => {
24
+ const bytes = new TextEncoder().encode('hello world')
25
+ expect(bytes).to.be.deep.equal(data)
26
+ })
27
28
+ it('can decode text', () => {
29
+ const text = new TextDecoder().decode(data)
30
+ expect(text).to.be.equal('hello world')
31
32
+})
0 commit comments