Skip to content

Commit

Permalink
test: 移除 lodash-es
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Mar 28, 2023
1 parent bb5afaa commit dd010b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
18 changes: 1 addition & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@commitlint/config-conventional": "^17.4.4",
"@commitlint/types": "^17.4.4",
"@rollup/plugin-typescript": "^11.0.0",
"@types/lodash-es": "^4.17.7",
"@types/node": "^18.15.7",
"@types/prettier": "^2.7.2",
"@typescript-eslint/eslint-plugin": "^5.55.0",
Expand Down
13 changes: 8 additions & 5 deletions test/generator.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { random } from 'lodash-es';
import path from 'path';
import { cleanDir, isFile } from 'src/utils';
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
import { generate, Generated, GenerateInfo, generateItem, OpenapiSpec, StrictConfig } from '../src';
import petstore3 from './petstore3.json';

function randomString(): string {
return Math.random().toString(16).slice(-6);
}

describe('generate-item', () => {
const cwd = process.cwd();
const dest = 'dist-test';
Expand All @@ -24,7 +27,7 @@ describe('generate-item', () => {
test(
'from url',
async () => {
const name = '/' + random(1, 1000) + '/' + random(1, 1000);
const name = '/' + randomString() + '/' + randomString();
const expectedFile = path.join(cwd, dest, name + '.ts');

const generated = await generateItem(
Expand All @@ -43,7 +46,7 @@ describe('generate-item', () => {
);

test('from sepc', async () => {
const name = '/' + random(1, 1000) + '/' + random(1, 1000);
const name = '/' + randomString() + '/' + randomString();
const expectedFile = path.join(cwd, dest, name + '.ts');

const generated = await generateItem(
Expand All @@ -69,11 +72,11 @@ test('generate', async () => {
dest: dest,
apis: [
{
name: random(1, 1000).toString(),
name: randomString(),
schema: petstore3 as unknown as OpenapiSpec,
},
{
name: random(1, 1000).toString(),
name: randomString(),
schema: petstore3 as unknown as OpenapiSpec,
},
],
Expand Down

0 comments on commit dd010b4

Please sign in to comment.