Skip to content

Commit 40ce449

Browse files
fix(test): reorganized tests under __tests__ directory
1 parent 1d295c9 commit 40ce449

27 files changed

+262
-398
lines changed

src/index.spec.ts renamed to src/__tests__/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import OpenAPI from './index';
1+
import OpenAPI from '../index';
22

33
describe('index', () => {
44
it('parses v2 without issues', async () => {

src/utils/__mocks__/templates.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Templates } from '../registerHandlebarTemplates';
2+
3+
export const templates: Templates = {
4+
index: () => 'index',
5+
client: () => 'client',
6+
useClient: () => 'useClient',
7+
exports: {
8+
model: () => 'model',
9+
schema: () => 'schema',
10+
service: () => 'service',
11+
hook: () => 'hook',
12+
},
13+
core: {
14+
settings: () => 'settings',
15+
apiError: () => 'apiError',
16+
apiRequestOptions: () => 'apiRequestOptions',
17+
apiResult: () => 'apiResult',
18+
cancelablePromise: () => 'cancelablePromise',
19+
request: () => 'request',
20+
baseHttpRequest: () => 'baseHttpRequest',
21+
httpRequest: () => 'httpRequest',
22+
hookUtils: () => 'hookUtils',
23+
},
24+
};

src/utils/flatMap.spec.ts renamed to src/utils/__tests__/flatMap.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { flatMap } from './flatMap';
1+
import { flatMap } from '../flatMap';
22

33
describe('flatMap', () => {
44
it('should produce correct result', () => {

src/utils/formatCode.spec.ts renamed to src/utils/__tests__/formatCode.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { formatCode } from './formatCode';
1+
import { formatCode } from '../formatCode';
22

33
const input1 = `{ foo: true }`;
44

src/utils/getModelNames.spec.ts renamed to src/utils/__tests__/getModelNames.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Model } from '../client/interfaces/Model';
2-
import { getModelNames } from './getModelNames';
1+
import type { Model } from '../../client/interfaces/Model';
2+
import { getModelNames } from '../getModelNames';
33

44
describe('getModelNames', () => {
55
it('should return sorted list', () => {

src/utils/getOpenApiVersion.spec.ts renamed to src/utils/__tests__/getOpenApiVersion.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getOpenApiVersion } from './getOpenApiVersion';
1+
import { getOpenApiVersion } from '../getOpenApiVersion';
22

33
describe('getOpenApiVersion', () => {
44
it('should read the correct version', () => {

src/utils/getPattern.spec.ts renamed to src/utils/__tests__/getPattern.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getPattern } from './getPattern';
1+
import { getPattern } from '../getPattern';
22

33
describe('getPattern', () => {
44
it('should produce correct result', () => {

src/utils/getServiceNames.spec.ts renamed to src/utils/__tests__/getServiceNames.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Service } from '../client/interfaces/Service';
2-
import { getServiceNames } from './getServiceNames';
1+
import type { Service } from '../../client/interfaces/Service';
2+
import { getServiceNames } from '../getServiceNames';
33

44
describe('getServiceNames', () => {
55
it('should return sorted list', () => {

src/utils/isSubdirectory.spec.ts renamed to src/utils/__tests__/isSubdirectory.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { resolve } from 'path';
22

3-
import { isSubDirectory } from './isSubdirectory';
3+
import { isSubDirectory } from '../isSubdirectory';
44

55
describe('isSubDirectory', () => {
66
it('should return correct result', () => {

src/utils/registerHandlebarHelpers.spec.ts renamed to src/utils/__tests__/registerHandlebarHelpers.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Handlebars from 'handlebars/runtime';
22

3-
import { HttpClient } from '../HttpClient';
4-
import { registerHandlebarHelpers } from './registerHandlebarHelpers';
3+
import { HttpClient } from '../../HttpClient';
4+
import { registerHandlebarHelpers } from '../registerHandlebarHelpers';
55

66
describe('registerHandlebarHelpers', () => {
77
it('should register the helpers', () => {

0 commit comments

Comments
 (0)