well-known-symbols
Version:
An ESnext spec-compliant shim/polyfill/replacement for all Well-Known Symbols that works in any environment with Symbols.
40 lines (29 loc) • 777 B
JavaScript
;
require('../auto');
var test = require('tape');
var forEach = require('for-each');
var hasSymbols = require('has-symbols/shams')();
var isWellKnownSymbol = require('is-well-known-symbol');
var shims = require('../');
var runTests = require('./tests');
test('shimmed', { skip: !hasSymbols }, function (t) {
forEach(shims, function (shim) {
var name = shim.replace(/^Symbol\./, '');
var symbol = Symbol[name];
t.test(shim, function (st) {
st.deepEqual(
Object.getOwnPropertyDescriptor(Symbol, name),
{
configurable: false,
enumerable: false,
value: symbol,
writable: false
}
);
st.ok(isWellKnownSymbol(symbol), 'is a well-known symbol');
runTests(st, shim, symbol);
st.end();
});
});
t.end();
});