summaryrefslogtreecommitdiff
path: root/packages/webapi/test/base64.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/webapi/test/base64.js')
-rw-r--r--packages/webapi/test/base64.js59
1 files changed, 20 insertions, 39 deletions
diff --git a/packages/webapi/test/base64.js b/packages/webapi/test/base64.js
index 695641805..8881784dc 100644
--- a/packages/webapi/test/base64.js
+++ b/packages/webapi/test/base64.js
@@ -1,48 +1,29 @@
-import { assert, test } from '../run/test.setup.js'
+import { expect } from 'chai'
import { polyfill } from '../mod.js'
-test(() => {
- return [
- {
- name: 'Supports Base64 Methods',
- test() {
- const target = {}
+describe('Base64', () => {
+ const target = {}
- polyfill(target)
+ before(() => polyfill(target))
- assert.equal('atob' in target, true)
- assert.equal('btoa' in target, true)
- assert.equal(typeof target['atob'], 'function')
- assert.equal(typeof target['btoa'], 'function')
- },
- },
- {
- name: 'Supports atob(data)',
- test() {
- const target = {}
+ it('Supports Base64 Methods', () => {
+ expect(target).to.have.property('atob').that.is.a('function')
+ expect(target).to.have.property('btoa').that.is.a('function')
+ })
- polyfill(target)
+ it('Supports atob(data)', () => {
+ const a = 'SGVsbG8sIHdvcmxk'
+ const b = target.atob(a)
- const a = 'SGVsbG8sIHdvcmxk'
- const b = target.atob(a)
+ expect(a).to.equal('SGVsbG8sIHdvcmxk')
+ expect(b).to.equal('Hello, world')
+ })
- assert.equal(a, 'SGVsbG8sIHdvcmxk')
- assert.equal(b, 'Hello, world')
- },
- },
- {
- name: 'Supports btoa(data)',
- test() {
- const target = {}
+ it('Supports btoa(data)', () => {
+ const b = 'Hello, world'
+ const a = target.btoa(b)
- polyfill(target)
-
- const b = 'Hello, world'
- const a = target.btoa(b)
-
- assert.equal(a, 'SGVsbG8sIHdvcmxk')
- assert.equal(b, 'Hello, world')
- },
- },
- ]
+ expect(a).to.equal('SGVsbG8sIHdvcmxk')
+ expect(b).to.equal('Hello, world')
+ })
})