2023-11-03 11:59:58 -04:00
|
|
|
/**
|
|
|
|
* Adapt the bun test interface to the shared testing interface
|
|
|
|
*/
|
2023-11-08 15:53:14 -05:00
|
|
|
import { expect, test as btest } from 'bun:test';
|
2023-11-08 18:07:34 -05:00
|
|
|
import { ITestBase } from '../common/mod.ts';
|
2023-11-03 11:59:58 -04:00
|
|
|
|
|
|
|
class TestBase implements ITestBase {
|
|
|
|
test(name: string, fn: () => void) {
|
|
|
|
return btest(name, fn);
|
|
|
|
}
|
|
|
|
|
|
|
|
assertEquals(actual: unknown, expected: unknown): void {
|
|
|
|
return expect(actual).toEqual(expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
assertExists(actual: unknown): void {
|
|
|
|
return expect(actual).toBeDefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
assertInstanceOf(actual: unknown, expectedType: any): void {
|
|
|
|
return expect(actual).toBeInstanceOf(expectedType);
|
|
|
|
}
|
|
|
|
|
|
|
|
assertNotEquals(actual: unknown, expected: unknown): void {
|
|
|
|
return expect(actual).not.toBe(expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
assertFalse(actual: boolean): void {
|
|
|
|
return expect(actual).toBe(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
assertTrue(actual: boolean): void {
|
|
|
|
return expect(actual).toBe(true);
|
|
|
|
}
|
2023-11-08 15:53:14 -05:00
|
|
|
|
|
|
|
assertStrictEquals(actual: unknown, expected: unknown): void {
|
|
|
|
return expect(actual).toBe(expected);
|
|
|
|
}
|
2023-11-03 11:59:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
const testBase = new TestBase();
|
2023-11-08 15:53:14 -05:00
|
|
|
export default testBase;
|