summaryrefslogtreecommitdiff
path: root/packages/webapi/test/base64.js
diff options
context:
space:
mode:
authorGravatar Juan Martín Seery <me@juanm04.com> 2022-04-10 22:29:46 -0300
committerGravatar GitHub <noreply@github.com> 2022-04-10 18:29:46 -0700
commit1907255ca239a94b76b1fe3a844a35f0436b8e3d (patch)
treef4c9935e0ea92f07478fece6a60b85795b24143a /packages/webapi/test/base64.js
parent47f20a189f5479b5e84f99e6feda3be7080e455f (diff)
downloadastro-1907255ca239a94b76b1fe3a844a35f0436b8e3d.tar.gz
astro-1907255ca239a94b76b1fe3a844a35f0436b8e3d.tar.zst
astro-1907255ca239a94b76b1fe3a844a35f0436b8e3d.zip
chore: webapi test now use chai (#3048)
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')
+ })
})