polyfills.js
This file
Path
__tests__/polyfills.js
48 lines · 1.1 KiB · JavaScript
Last changed by
fix: Map and Set instantions won't work on certain environments, fixes #502Michel Weststratebefore adoption9f4711a
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849const {assign} = Objectconst {ownKeys} = Reflectconst SymbolConstructor = Symbol
Symbol = undefinedObject.assign = undefinedReflect.ownKeys = undefined
jest.resetModules()const common = require("../src/internal")
// Reset the globals to avoid unintended effects.Symbol = SymbolConstructorObject.assign = assignReflect.ownKeys = ownKeys
describe("Symbol", () => { test("NOTHING", () => { const value = common.NOTHING expect(value).toBeTruthy() expect(typeof value).toBe("object") }) test("DRAFTABLE", () => { const value = common.DRAFTABLE expect(typeof value).toBe("string") }) test("DRAFT_STATE", () => { const value = common.DRAFT_STATE expect(typeof value).toBe("string") })})
describe("Reflect.ownKeys", () => { const {ownKeys} = common
// Symbol keys are always last. it("includes symbol keys", () => { const s = SymbolConstructor() const obj = {[s]: 1, b: 1} expect(ownKeys(obj)).toEqual(["b", s]) })
it("includes non-enumerable keys", () => { const obj = {a: 1} Object.defineProperty(obj, "b", {value: 1}) expect(ownKeys(obj)).toEqual(["a", "b"]) })})