UNPKG

@schukai/monster

Version:

Monster is a simple library for creating fast, robust and lightweight websites.

63 lines (39 loc) 1.28 kB
"use strict"; import {expect} from "chai" import {Base} from "../../../source/types/base.mjs"; import {instanceSymbol} from "../../../source/constants.mjs"; class BaseDifferentRealm extends Object { static get [instanceSymbol]() { return Symbol.for("@schukai/monster/types/base"); } } class Subclass extends BaseDifferentRealm { constructor() { super(); } static get [instanceSymbol]() { return Symbol.for("@schukai/monster/types/subclass"); } } describe('Base', function () { describe('new Base', function () { it('is instance of Base', function () { expect(new Base).to.be.instanceOf(Base); }); it('is instance of Object', function () { expect(new Base).to.be.instanceOf(Object); }); }) describe('instancof', function () { it('is instance of Base', function () { expect(new Base).to.be.instanceOf(Base); }); it('subclass instanceof', function () { if (new Subclass instanceof Base) { expect(true).to.be.true; } else { expect(false).to.be.true; } }); }) })