Skip to content

Commit

Permalink
test: add atob and btoa cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Oct 16, 2023
1 parent 521bff7 commit c2d9c3c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/integration-tests/tests/encoding.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TextDecoder } from '@edge-runtime/ponyfill'
import { atob, btoa, TextDecoder } from '@edge-runtime/ponyfill'

test('TextDecoder', () => {
const input = new Uint8Array([
Expand All @@ -22,3 +22,12 @@ test('TextDecoder with stream', () => {

expect(result).toBe('{"greeting":"hello"}')
})

test('btoa', async () => {
expect(btoa('Hello, world')).toBe('SGVsbG8sIHdvcmxk')
expect(btoa(new Uint8Array([1, 2, 3]).toString())).toBe('MSwyLDM=')
})

test('atob', async () => {
expect(atob('SGVsbG8sIHdvcmxk')).toBe('Hello, world')
})

0 comments on commit c2d9c3c

Please sign in to comment.