Files
drizzlebox/tests/utils.ts
glm-5.1 d0a0de766b feat: fork drizzle-typebox as @alkdev/drizzlebox
- Rebrand package from drizzle-typebox to @alkdev/drizzlebox
- Replace @sinclair/typebox with @alkdev/typebox in all source and test files
- Replace @sinclair/typebox with @alkdev/typebox in rollup externals
- Convert tsconfig.json from monorepo extends to standalone config
- Fix build script monorepo remnant (dist.new -> dist)
- Add missing devDependencies (recast, tsx, typescript, resolve-tspaths)
- Replace monorepo link dependency for drizzle-orm with ^0.38.4
- Add .gitignore, LICENSE (Apache-2.0 with attribution), and README
- Initialize git repo with remote at git.alk.dev:alkdev/drizzlebox
2026-04-25 09:45:14 +00:00

35 lines
997 B
TypeScript

import type * as t from '@alkdev/typebox';
import { expect, type TaskContext } from 'vitest';
function removeKeysFromObject(obj: Record<string, any>, keys: string[]) {
for (const key of keys) {
delete obj[key];
}
return obj;
}
export function expectSchemaShape<T extends t.TObject>(t: TaskContext, expected: T) {
return {
from(actual: T) {
expect(Object.keys(actual.properties)).toStrictEqual(Object.keys(expected.properties));
const keys = ['$id', '$schema', 'title', 'description', 'default', 'examples', 'readOnly', 'writeOnly'];
for (const key of Object.keys(actual.properties)) {
expect(removeKeysFromObject(actual.properties[key]!, keys)).toStrictEqual(
removeKeysFromObject(expected.properties[key]!, keys),
);
}
},
};
}
export function expectEnumValues<T extends t.TEnum<any>>(t: TaskContext, expected: T) {
return {
from(actual: T) {
expect(actual.anyOf).toStrictEqual(expected.anyOf);
},
};
}
export function Expect<_ extends true>() {}