0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/webapi/test/base64.js

30 lines
672 B
JavaScript
Raw Normal View History

import { expect } from 'chai'
import { polyfill } from '../mod.js'
describe('Base64', () => {
const target = {}
2022-03-07 16:37:50 -05:00
before(() => polyfill(target))
2022-03-07 16:37:50 -05:00
it('Supports Base64 Methods', () => {
expect(target).to.have.property('atob').that.is.a('function')
expect(target).to.have.property('btoa').that.is.a('function')
})
2022-03-07 16:37:50 -05:00
it('Supports atob(data)', () => {
const a = 'SGVsbG8sIHdvcmxk'
const b = target.atob(a)
expect(a).to.equal('SGVsbG8sIHdvcmxk')
expect(b).to.equal('Hello, world')
})
it('Supports btoa(data)', () => {
const b = 'Hello, world'
const a = target.btoa(b)
2022-03-07 16:37:50 -05:00
expect(a).to.equal('SGVsbG8sIHdvcmxk')
expect(b).to.equal('Hello, world')
})
})