Skip to content

Commit dd010b4

Browse files
committed
test: 移除 lodash-es
1 parent bb5afaa commit dd010b4

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

package-lock.json

Lines changed: 1 addition & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"@commitlint/config-conventional": "^17.4.4",
6464
"@commitlint/types": "^17.4.4",
6565
"@rollup/plugin-typescript": "^11.0.0",
66-
"@types/lodash-es": "^4.17.7",
6766
"@types/node": "^18.15.7",
6867
"@types/prettier": "^2.7.2",
6968
"@typescript-eslint/eslint-plugin": "^5.55.0",

test/generator.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { random } from 'lodash-es';
21
import path from 'path';
32
import { cleanDir, isFile } from 'src/utils';
43
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
54
import { generate, Generated, GenerateInfo, generateItem, OpenapiSpec, StrictConfig } from '../src';
65
import petstore3 from './petstore3.json';
76

7+
function randomString(): string {
8+
return Math.random().toString(16).slice(-6);
9+
}
10+
811
describe('generate-item', () => {
912
const cwd = process.cwd();
1013
const dest = 'dist-test';
@@ -24,7 +27,7 @@ describe('generate-item', () => {
2427
test(
2528
'from url',
2629
async () => {
27-
const name = '/' + random(1, 1000) + '/' + random(1, 1000);
30+
const name = '/' + randomString() + '/' + randomString();
2831
const expectedFile = path.join(cwd, dest, name + '.ts');
2932

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

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

4952
const generated = await generateItem(
@@ -69,11 +72,11 @@ test('generate', async () => {
6972
dest: dest,
7073
apis: [
7174
{
72-
name: random(1, 1000).toString(),
75+
name: randomString(),
7376
schema: petstore3 as unknown as OpenapiSpec,
7477
},
7578
{
76-
name: random(1, 1000).toString(),
79+
name: randomString(),
7780
schema: petstore3 as unknown as OpenapiSpec,
7881
},
7982
],

0 commit comments

Comments
 (0)