Skip to main content
Glama
null-object.test.js947 B
'use strict' const { test } = require('node:test') const { NullObject } = require('../lib/null-object') test('NullObject', t => { t.plan(2) const nullObject = new NullObject() t.assert.ok(nullObject instanceof NullObject) t.assert.ok(typeof nullObject === 'object') }) test('has no methods from generic Object class', t => { function getAllPropertyNames (obj) { const props = [] do { Object.getOwnPropertyNames(obj).forEach(function (prop) { if (props.indexOf(prop) === -1) { props.push(prop) } }) } while (obj = Object.getPrototypeOf(obj)) // eslint-disable-line return props } const propertyNames = getAllPropertyNames({}) t.plan(propertyNames.length + 1) const nullObject = new NullObject() for (const propertyName of propertyNames) { t.assert.ok(!(propertyName in nullObject), propertyName) } t.assert.equal(getAllPropertyNames(nullObject).length, 0) })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/krtw00/search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server