diff options
Diffstat (limited to 'packages/webapi/test')
-rw-r--r-- | packages/webapi/test/base64.js | 29 | ||||
-rw-r--r-- | packages/webapi/test/basic.js | 98 |
2 files changed, 0 insertions, 127 deletions
diff --git a/packages/webapi/test/base64.js b/packages/webapi/test/base64.js deleted file mode 100644 index 8881784dc..000000000 --- a/packages/webapi/test/base64.js +++ /dev/null @@ -1,29 +0,0 @@ -import { expect } from 'chai' -import { polyfill } from '../mod.js' - -describe('Base64', () => { - const target = {} - - before(() => polyfill(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') - }) - - 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) - - expect(a).to.equal('SGVsbG8sIHdvcmxk') - expect(b).to.equal('Hello, world') - }) -}) diff --git a/packages/webapi/test/basic.js b/packages/webapi/test/basic.js index 5ee48d033..9eb5864d5 100644 --- a/packages/webapi/test/basic.js +++ b/packages/webapi/test/basic.js @@ -6,9 +6,6 @@ describe('Basic', () => { it('Globals exist', () => { const webAPIs = [ - 'AbortController', - 'AbortSignal', - 'Blob', 'ByteLengthQueuingStrategy', 'CSSStyleSheet', 'CountQueuingStrategy', @@ -66,32 +63,6 @@ describe('Basic', () => { } }) - it('Constructs an Event', () => { - const e = new Event('test') - - expect(e.type).to.equal('test') - }) - - it('Constructs an EventTarget', () => { - const _t = new EventTarget() - }) - - it('Dispatches an Event on an EventTarget', () => { - const t = new EventTarget() - - let pass = false - - t.addEventListener('test', (event) => { - pass = true - }) - - const e = new Event('test') - - t.dispatchEvent(e) - - expect(pass).to.equal(true) - }) - it('Classes extend as expected', () => { expect(HTMLElement.prototype).to.be.an.instanceof(Element) expect(Element.prototype).to.be.an.instanceof(Node) @@ -113,73 +84,4 @@ describe('Basic', () => { it('globalThis.window === globalThis', () => { expect(globalThis.window).to.equal(globalThis) }) - - it('Relative Indexing Method (String#at)', () => { - expect(String.prototype.at).to.be.a('function') - expect(String.prototype.at.length).to.equal(1) - - const example = 'The quick brown fox jumps over the lazy dog.' - - expect(example.at(2)).to.equal('e') - expect(example.at(-2)).to.equal('g') - }) - - it('Relative Indexing Method (Array#at)', () => { - expect(Array.prototype.at).to.be.a('function') - expect(Array.prototype.at.length).to.equal(1) - - const example = [1, 3, 5, 7, 9] - - expect(example.at(1)).to.equal(3) - expect(example.at(-1)).to.equal(9) - }) - - it('Relative Indexing Method (TypedArray#at)', () => { - expect(Int8Array.prototype.at).to.be.a('function') - expect(Int8Array.prototype.at.length).to.equal(1) - - const example = new Int8Array([1, 3, 5, 7, 9]) - - expect(example.at(1)).to.equal(3) - expect(example.at(-1)).to.equal(9) - }) - - it('Object.hasOwn', () => { - expect(Object.hasOwn).to.be.a('function') - expect(Object.hasOwn.length).to.equal(2) - - const example = {} - - expect(Object.hasOwn(example, 'prop')).to.equal(false) - - example.prop = 'exists' - - expect(Object.hasOwn(example, 'prop')).to.equal(true) - }) - - it('Promise.any', () => { - expect(Promise.any).to.be.a('function') - expect(Promise.any.length).to.equal(1) - - Promise.any([ - Promise.resolve(42), - Promise.reject(-1), - Promise.reject(Infinity), - ]).then((result) => { - expect(result).to.equal(42) - }) - }) - - it('String#replaceAll', () => { - expect(String.prototype.replaceAll).to.be.a('function') - expect(String.prototype.replaceAll.length).to.equal(2) - - const t1 = - 'Of all the sorcerers in Harry Potter, Halo is my favorite sorcerer.' - const t2 = t1.replaceAll('sorcerer', 'philosopher') - const t3 = - 'Of all the philosophers in Harry Potter, Halo is my favorite philosopher.' - - expect(t2).to.equal(t3) - }) }) |