/** * Adapt the bun test interface to the shared testing interface */ import { describe, expect, test } from 'bun:test'; import { ITestBase } from '../common/types.ts'; export function testSuite(testObj: any) { Object.keys(testObj).forEach((group) => { describe(group, () => { const groupObj = testObj[group]; Object.keys(groupObj).forEach((testName) => { test(testName, groupObj[testName]); }); }); }); } const BunTestBase: ITestBase = { assertEquals: (actual: unknown, expected: unknown) => expect(actual).toEqual(expected), assertExists: (actual: unknown) => expect(actual).toBeDefined(), assertFalse: (actual: boolean) => expect(actual).toBe(false), assertInstanceOf: (actual: unknown, expectedType: any) => expect(actual).toBeInstanceOf(expectedType), assertNotEquals: (actual: unknown, expected: unknown) => expect(actual).not.toBe(expected), assertStrictEquals: (actual: unknown, expected: unknown) => expect(actual).toBe(expected), assertTrue: (actual: boolean) => expect(actual).toBe(true), testSuite, }; export default BunTestBase;