Skip to content

chore: restructure folder #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"build": "tsc",
"lint:fix": "yarn workspace javascript-tests lint:fix",
"generate": "node dist/tests/src/main.js ${0:-javascript} ${1:-search}",
"start": "yarn build && yarn generate ${0:-javascript} ${1:-search} && yarn lint:fix"
"generate:cts": "node dist/tests/src/cts/main.js ${0:-javascript} ${1:-search}",
"start": "yarn build && yarn generate:cts ${0:-javascript} ${1:-search} && yarn lint:fix"
},
"devDependencies": {
"@apidevtools/swagger-parser": "10.0.3",
Expand Down
2 changes: 1 addition & 1 deletion tests/src/cts.ts → tests/src/cts/cts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwaggerParser from '@apidevtools/swagger-parser';
import type { OpenAPIV3 } from 'openapi-types';

import type { CTS, CTSBlock, Tests } from './types';
import { removeObjectName, walk } from './utils';
import { removeObjectName, walk } from '../utils';

async function loadRequestsCTS(client: string): Promise<CTSBlock[]> {
// load the list of operations from the spec
Expand Down
3 changes: 1 addition & 2 deletions tests/src/generate.ts → tests/src/cts/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import Mustache from 'mustache';
import { loadCTS } from './cts';
import { loadRequestsTemplate } from './templates';
import type { CTSBlock } from './types';
import { extensionForLanguage } from './types';
import { createClientName, packageNames } from './utils';
import { createClientName, packageNames, extensionForLanguage } from '../utils';

async function createOutputDir(language: string): Promise<void> {
await fsp.mkdir(`output/${language}`, { recursive: true });
Expand Down
2 changes: 1 addition & 1 deletion tests/src/main.ts → tests/src/cts/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */

import { generateTests } from './generate';
import { packageNames } from './utils';
import { packageNames } from '../utils';

function printUsage(): void {
console.log(`usage: generateCTS language client`);
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions tests/src/types.ts → tests/src/cts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,3 @@ export type CTSBlock = {
export type CTS = {
requests: CTSBlock[];
};

export const extensionForLanguage: Record<string, string> = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved to to utils, because it's more like util than a type. WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it makes sense ! Do you plan on expanding inside the cts folder or create another folder for the clients tests ?

javascript: 'test.ts',
java: 'java',
};
5 changes: 5 additions & 0 deletions tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ export function removeObjectName(obj: Record<string, any>): void {
}
}
}

export const extensionForLanguage: Record<string, string> = {
javascript: 'test.ts',
java: 'java',
};