1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-23 02:04:34 +02:00
video.js/test/unit/utils/promise.test.js
Alex Barstow dd1b478e4d feat: assume native promises, remove promise option and workarounds (#7715)
BREAKING CHANGE: Removes support for Promise class option and assumes native Promise is available. Will break in older browsers or devices.
2022-11-23 09:48:13 -05:00

15 lines
622 B
JavaScript

/* eslint-env qunit */
import window from 'global/window';
import * as promise from '../../../src/js/utils/promise';
QUnit.module('utils/promise');
QUnit.test('can correctly identify a native Promise (if supported)', function(assert) {
assert.ok(promise.isPromise(new window.Promise((resolve) => resolve())), 'a native Promise was recognized');
});
QUnit.test('can identify a Promise-like object', function(assert) {
assert.notOk(promise.isPromise({}), 'an object without a `then` method is not Promise-like');
assert.ok(promise.isPromise({then: () => {}}), 'an object with a `then` method is Promise-like');
});