polyfills.js
This file
Path
__tests__/polyfills.js
54 lines · 1.2 KiB · JavaScript
Last changed by
chore: verify build during testMichel Weststratebefore adoptionef8990b
History of this fileTake it
test: polyfillsaleclarsonbefore adoption551d877
lines 1–9why, one step back1const {assign} = Object2const {ownKeys} = Reflect3const SymbolConstructor = Symbol45Symbol = undefined6Object.assign = undefined7Reflect.ownKeys = undefined89jest.resetModules()fix: Map and Set instantions won't work on certain environments, fixes #502Michel Weststratebefore adoption9f4711a
line 10why, one step back10const common = require("../src/internal")test: polyfillsaleclarsonbefore adoption551d877
lines 11–16why, one step back1112// Reset the globals to avoid unintended effects.13Symbol = SymbolConstructor14Object.assign = assign15Reflect.ownKeys = ownKeys16chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 17–31why, one step back17if (!global.USES_BUILD)18 describe("Symbol", () => {19 test("NOTHING", () => {20 const value = common.NOTHING21 expect(value).toBeTruthy()22 expect(typeof value).toBe("object")23 })24 test("DRAFTABLE", () => {25 const value = common.DRAFTABLE26 expect(typeof value).toBe("string")27 })28 test("DRAFT_STATE", () => {29 const value = common.DRAFT_STATE30 expect(typeof value).toBe("string")31 })style: use tabsuse-tabsbefore adoptiona9c0fd0
line 32why, one step back32 })test: polyfillsaleclarsonbefore adoption551d877
line 33why, one step back33chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 34–36why, one step back34if (!global.USES_BUILD)35 describe("Reflect.ownKeys", () => {36 const {ownKeys} = commontest: polyfillsaleclarsonbefore adoption551d877
line 37why, one step back37chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 38–43why, one step back38 // Symbol keys are always last.39 it("includes symbol keys", () => {40 const s = SymbolConstructor()41 const obj = {[s]: 1, b: 1}42 expect(ownKeys(obj)).toEqual(["b", s])43 })test: polyfillsaleclarsonbefore adoption551d877
line 44why, one step back44chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 45–49why, one step back45 it("includes non-enumerable keys", () => {46 const obj = {a: 1}47 Object.defineProperty(obj, "b", {value: 1})48 expect(ownKeys(obj)).toEqual(["a", "b"])49 })style: use tabsuse-tabsbefore adoptiona9c0fd0
line 50why, one step back50 })chore: verify build during testMichel Weststratebefore adoptionef8990b
lines 51–53why, one step back5152test("suppress jest warning", () => {53 expect(true).toBe(true)test: polyfillsaleclarsonbefore adoption551d877
line 54why, one step back54})