mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import type { Service } from '../client/interfaces/Service';
|
|
import { writeFile } from './fileSystem';
|
|
import { Templates } from './registerHandlebarTemplates';
|
|
import { writeClientServices } from './writeClientServices';
|
|
|
|
jest.mock('./fileSystem');
|
|
|
|
describe('writeClientServices', () => {
|
|
it('should write to filesystem', async () => {
|
|
const services: Service[] = [
|
|
{
|
|
name: 'MyService',
|
|
operations: [],
|
|
imports: [],
|
|
},
|
|
];
|
|
|
|
const templates: Templates = {
|
|
index: () => 'index',
|
|
exports: {
|
|
model: () => 'model',
|
|
schema: () => 'schema',
|
|
service: () => 'service',
|
|
},
|
|
core: {
|
|
settings: () => 'settings',
|
|
apiError: () => 'apiError',
|
|
apiRequestOptions: () => 'apiRequestOptions',
|
|
apiResult: () => 'apiResult',
|
|
request: () => 'request',
|
|
},
|
|
};
|
|
|
|
await writeClientServices(services, templates, '/', false);
|
|
|
|
expect(writeFile).toBeCalledWith('/MyService.ts', 'service');
|
|
});
|
|
});
|