hey-api-builders
Version:
A custom plugin for @hey-api/openapi-ts that generates mock data builders with a lightweight custom runtime, Zod integration, or static mock generation.
64 lines • 2.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const config_1 = require("./config");
(0, vitest_1.describe)('config', () => {
(0, vitest_1.describe)('defaultConfig', () => {
(0, vitest_1.it)('should have correct name', () => {
(0, vitest_1.expect)(config_1.defaultConfig.name).toBe('hey-api-builders');
});
(0, vitest_1.it)('should have correct output', () => {
(0, vitest_1.expect)(config_1.defaultConfig.output).toBe('builders');
});
(0, vitest_1.it)('should have required dependencies', () => {
(0, vitest_1.expect)(config_1.defaultConfig.dependencies).toEqual(['@hey-api/schemas', '@hey-api/typescript']);
});
(0, vitest_1.it)('should have handler function', () => {
(0, vitest_1.expect)(typeof config_1.defaultConfig.handler).toBe('function');
});
(0, vitest_1.it)('should have empty config by default', () => {
(0, vitest_1.expect)(config_1.defaultConfig.config).toEqual({});
});
});
(0, vitest_1.describe)('defineConfig', () => {
(0, vitest_1.it)('should return config with custom options', () => {
const config = (0, config_1.defineConfig)({
generateZod: true,
mockStrategy: 'static',
});
(0, vitest_1.expect)(config).toBeDefined();
});
(0, vitest_1.it)('should return config with mockStrategy zod', () => {
const config = (0, config_1.defineConfig)({
mockStrategy: 'zod',
});
(0, vitest_1.expect)(config).toBeDefined();
});
(0, vitest_1.it)('should return config with mockStrategy runtime', () => {
const config = (0, config_1.defineConfig)({
mockStrategy: 'runtime',
});
(0, vitest_1.expect)(config).toBeDefined();
});
(0, vitest_1.it)('should return config with no options', () => {
const config = (0, config_1.defineConfig)({});
(0, vitest_1.expect)(config).toBeDefined();
});
(0, vitest_1.it)('should return config with all options', () => {
const config = (0, config_1.defineConfig)({
generateZod: true,
mockStrategy: 'zod',
});
(0, vitest_1.expect)(config).toBeDefined();
});
(0, vitest_1.it)('should support backward compatibility with deprecated flags', () => {
const config = (0, config_1.defineConfig)({
generateZod: true,
useZodForMocks: true,
useStaticMocks: false,
});
(0, vitest_1.expect)(config).toBeDefined();
});
});
});
//# sourceMappingURL=config.test.js.map