1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
metamask-extension/test/unit-global/frozenPromise.test.js
kumavis 9f4820ee98
Build - refactor for bundle factoring and swappable runtime (#11080)
* wip

* build - breakout sentry-install bundle

* deps - move new build sys deps to published versions

* chore: lint fix

* clean - remove unused file

* clean - remove unsused package script

* lavamoat - update build system policy

* build - render html to all platforms

* development - improve sourcemap debugger output

* deps - update lavapack

* lint - fix

* deps - update lavapack for bugfix

* deps - update lavapack for bugfix

* deps - bump lavapack for line ending normalization

* sourcemap explorer - disable boundary validation

* ci - reset normal ci flow

* build - re-enable minification on prod

* build - remove noisy log about html dest

* build - update terser and remove gulp wrapper for sourcemap fix

* Revert "sourcemap explorer - disable boundary validation"

This reverts commit 94112209ed880a6ebf4ee2ded411e59db6908162.

* build - reenable react-devtools in dev mode

* wip

* build - breakout sentry-install bundle

* deps - move new build sys deps to published versions

* chore: lint fix

* clean - remove unused file

* clean - remove unsused package script

* lavamoat - update build system policy

* build - render html to all platforms

* development - improve sourcemap debugger output

* deps - update lavapack

* lint - fix

* deps - update lavapack for bugfix

* deps - update lavapack for bugfix

* deps - bump lavapack for line ending normalization

* sourcemap explorer - disable boundary validation

* ci - reset normal ci flow

* build - re-enable minification on prod

* build - remove noisy log about html dest

* build - update terser and remove gulp wrapper for sourcemap fix

* Revert "sourcemap explorer - disable boundary validation"

This reverts commit 94112209ed880a6ebf4ee2ded411e59db6908162.

* build - reenable react-devtools in dev mode

* Updating lockfile

* lint fix

* build/dev - patch watchifys incompatible binary stats output

* ui - add comment about conditional import

* build - improve comment

* Update development/stream-flat-map.js

Co-authored-by: Brad Decker <git@braddecker.dev>

* Outputting all bundle file links (metamaskbot)

Co-authored-by: ryanml <ryanlanese@gmail.com>
Co-authored-by: Brad Decker <git@braddecker.dev>
2021-07-15 10:59:34 -07:00

54 lines
1.4 KiB
JavaScript

// Should occur before anything else
import './globalPatch';
import 'ses/lockdown';
import '../../app/scripts/lockdown-run';
import { strict as assert } from 'assert'; /* eslint-disable-line import/first,import/order */
describe('Promise global is immutable', function () {
it('throws when reassinging promise (syntax 1)', function () {
try {
// eslint-disable-next-line no-global-assign,no-native-reassign
Promise = {};
assert.fail('did not throw error');
} catch (err) {
assert.ok(err, 'did throw error');
}
});
it('throws when reassinging promise (syntax 2)', function () {
try {
global.Promise = {};
assert.fail('did not throw error');
} catch (err) {
assert.ok(err, 'did throw error');
}
});
it('throws when mutating existing Promise property', function () {
try {
Promise.all = () => undefined;
assert.fail('did not throw error');
} catch (err) {
assert.ok(err, 'did throw error');
}
});
it('throws when adding new Promise property', function () {
try {
Promise.foo = 'bar';
assert.fail('did not throw error');
} catch (err) {
assert.ok(err, 'did throw error');
}
});
it('throws when deleting Promise from global', function () {
try {
delete global.Promise;
assert.fail('did not throw error');
} catch (err) {
assert.ok(err, 'did throw error');
}
});
});