openapi-typescript-codegen/src/utils/getServiceNames.spec.ts
2020-11-18 23:16:57 +01:00

28 lines
742 B
TypeScript

import type { Service } from '../client/interfaces/Service';
import { getServiceNames } from './getServiceNames';
describe('getServiceNames', () => {
it('should return sorted list', () => {
const john: Service = {
name: 'John',
operations: [],
imports: [],
};
const jane: Service = {
name: 'Jane',
operations: [],
imports: [],
};
const doe: Service = {
name: 'Doe',
operations: [],
imports: [],
};
const services = [john, jane, doe];
expect(getServiceNames([])).toEqual([]);
expect(getServiceNames(services)).toEqual(['Doe', 'Jane', 'John']);
});
});