Skip to main content
Glama
mod_test.ts2.76 kB
import { assertEquals } from "@std/assert"; import { removeEmpty } from "./mod.ts"; Deno.test(function simpleObject() { const startingObj = { "one": "one", "two": {}, "three": undefined, "four": null, "five": [], }; const finishedObj = { "one": "one", }; assertEquals(removeEmpty(startingObj), finishedObj); }); Deno.test(function nestedObject() { const startingObj = { "one": "one", "two": {}, "three": undefined, "four": null, "five": [], "six": { "seven": {}, }, }; const finishedObj = { "one": "one", }; assertEquals(removeEmpty(startingObj), finishedObj); }); Deno.test(function nestedArray() { const startingObj = { "one": "one", "two": {}, "three": undefined, "four": null, "five": [], "six": { "seven": { "eight": [], }, }, }; const finishedObj = { "one": "one", }; assertEquals(removeEmpty(startingObj), finishedObj); }); Deno.test(function nestedArrayWithEmptyObject() { const startingObj = { "one": "one", "two": {}, "three": undefined, "four": null, "five": [], "six": { "seven": { "eight": [{}], }, }, }; const finishedObj = { "one": "one", }; assertEquals(removeEmpty(startingObj), finishedObj); }); Deno.test(function nestedArrayWithEmptyObjectNulls() { const startingObj = { "one": "one", "two": {}, "three": undefined, "four": null, "five": [], "six": { "seven": { "eight": [{}, null, undefined, {}], }, }, }; const finishedObj = { "one": "one", }; assertEquals(removeEmpty(startingObj), finishedObj); }); Deno.test(function autoScaleGroup() { const startingObj = { "TypeName": "AWS::AutoScaling::AutoScalingGroup", "DesiredState": { "MaxSize": "3", "MinSize": "3", "CapacityReservationSpecification": { "CapacityReservationTarget": {}, }, "LaunchTemplate": { "LaunchTemplateName": "funky", "Version": "1", }, "MixedInstancesPolicy": { "LaunchTemplate": {}, }, "VPCZoneIdentifier": [ "subnet-0abeed19b31871e40", "subnet-024c8c85874c47841", "subnet-0ce0acf3ada90fbf5", ], }, }; const finishObj = { "TypeName": "AWS::AutoScaling::AutoScalingGroup", "DesiredState": { "MaxSize": "3", "MinSize": "3", "LaunchTemplate": { "LaunchTemplateName": "funky", "Version": "1", }, "VPCZoneIdentifier": [ "subnet-0abeed19b31871e40", "subnet-024c8c85874c47841", "subnet-0ce0acf3ada90fbf5", ], }, }; assertEquals(removeEmpty(startingObj), finishObj); });

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/systeminit/si'

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