From ab116cc547a41a17088d81caa939add23e7558b9 Mon Sep 17 00:00:00 2001 From: Artem Leshchev Date: Fri, 29 Sep 2023 14:20:22 +0200 Subject: [PATCH] Fix tests --- .vscode/settings.json | 22 ------------------- .../method-parameter/MethodModel.spec.ts | 8 +++---- .../MethodParameterModelBase.spec.ts | 9 ++++---- .../services/ModelMappingService.spec.ts | 5 +++-- package-lock.json | 4 ++-- package.json | 2 +- 6 files changed, 15 insertions(+), 35 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4b58cf7..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, - "typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, - "typescript.tsdk": "node_modules\\typescript\\lib", - "peacock.color": "#3ab3da", - "workbench.colorCustomizations": { - "activityBar.activeBackground": "#65c4e2", - "activityBar.activeBorder": "#d728ad", - "activityBar.background": "#65c4e2", - "activityBar.foreground": "#15202b", - "activityBar.inactiveForeground": "#15202b99", - "activityBarBadge.background": "#d728ad", - "activityBarBadge.foreground": "#e7e7e7", - "statusBar.background": "#3ab3da", - "statusBar.foreground": "#15202b", - "statusBarItem.hoverBackground": "#2498bd", - "titleBar.activeBackground": "#653ada", - "titleBar.activeForeground": "#15202b", - "titleBar.inactiveBackground": "#3ab3da99", - "titleBar.inactiveForeground": "#15202b99" - }, -} \ No newline at end of file diff --git a/__tests__/models/method-parameter/MethodModel.spec.ts b/__tests__/models/method-parameter/MethodModel.spec.ts index 95a1c72..9860d7f 100644 --- a/__tests__/models/method-parameter/MethodModel.spec.ts +++ b/__tests__/models/method-parameter/MethodModel.spec.ts @@ -1,12 +1,12 @@ +import { MockOpenAPIService } from '../../../__mocks__/MockOpenAPIService'; import { ParameterPlace } from '../../../src/models/kinds/ParameterPlace'; -import { IQueryParameter } from '../../../src/models/method-parameter/IQueryParameter'; import { PathMethodParameterModel } from '../../../src/models/method-parameter/PathMethodParameterModel'; import { QueryMethodParameterModel } from '../../../src/models/method-parameter/QueryMethodParameterModel'; +import { defaultOptions } from '../../../src/options'; import { TypesService } from '../../../src/services/TypesService'; +import { OpenAPIService } from '../../../src/swagger/OpenAPIService'; import { OpenAPITypesGuard } from '../../../src/swagger/OpenAPITypesGuard'; import { IOpenAPI3Parameter } from '../../../src/swagger/v3/parameter'; -import { OpenAPIService } from '../../../src/swagger/OpenAPIService'; -import { MockOpenAPIService } from '../../../__mocks__/MockOpenAPIService'; describe('MethodParameterModel tests', () => { let typesGuard: OpenAPITypesGuard; @@ -15,7 +15,7 @@ describe('MethodParameterModel tests', () => { beforeEach(() => { typesGuard = new OpenAPITypesGuard(); - typesService = new TypesService(typesGuard); + typesService = new TypesService(typesGuard, defaultOptions); openAPIService = new MockOpenAPIService(typesGuard); }); diff --git a/__tests__/models/method-parameter/MethodParameterModelBase.spec.ts b/__tests__/models/method-parameter/MethodParameterModelBase.spec.ts index c5aa1b5..4c9b19c 100644 --- a/__tests__/models/method-parameter/MethodParameterModelBase.spec.ts +++ b/__tests__/models/method-parameter/MethodParameterModelBase.spec.ts @@ -1,10 +1,11 @@ +import { MockOpenAPIService } from '../../../__mocks__/MockOpenAPIService'; import { ParameterPlace } from '../../../src/models/kinds/ParameterPlace'; +import { MethodParameterModelBase } from '../../../src/models/method-parameter/MethodParameterModelBase'; +import { defaultOptions } from '../../../src/options'; import { TypesService } from '../../../src/services/TypesService'; +import { OpenAPIService } from '../../../src/swagger/OpenAPIService'; import { OpenAPITypesGuard } from '../../../src/swagger/OpenAPITypesGuard'; import { IOpenAPI3Parameter } from '../../../src/swagger/v3/parameter'; -import { OpenAPIService } from '../../../src/swagger/OpenAPIService'; -import { MockOpenAPIService } from '../../../__mocks__/MockOpenAPIService'; -import { MethodParameterModelBase } from '../../../src/models/method-parameter/MethodParameterModelBase'; import { IOpenAPI3EnumSchema } from '../../../src/swagger/v3/schemas/enum-schema'; describe('MethodParameterModelBase tests', () => { @@ -18,7 +19,7 @@ describe('MethodParameterModelBase tests', () => { beforeEach(() => { typesGuard = new OpenAPITypesGuard(); - typesService = new TypesService(typesGuard); + typesService = new TypesService(typesGuard, defaultOptions); openAPIService = new MockOpenAPIService(typesGuard); }); diff --git a/__tests__/services/ModelMappingService.spec.ts b/__tests__/services/ModelMappingService.spec.ts index d070f05..bd98ccd 100644 --- a/__tests__/services/ModelMappingService.spec.ts +++ b/__tests__/services/ModelMappingService.spec.ts @@ -1,4 +1,5 @@ import { MockOpenAPIService } from '../../__mocks__/MockOpenAPIService'; +import { defaultOptions } from '../../src/options'; import { ModelMappingService } from '../../src/services/ModelMappingService'; import { TypesService } from '../../src/services/TypesService'; import { OpenAPITypesGuard } from '../../src/swagger/OpenAPITypesGuard'; @@ -11,7 +12,7 @@ describe('ModelMappingService tests', () => { beforeEach(() => { const guard = new OpenAPITypesGuard(); const openAPIService = new MockOpenAPIService(guard); - service = new ModelMappingService(openAPIService, guard, new TypesService(guard)); + service = new ModelMappingService(openAPIService, guard, new TypesService(guard, defaultOptions)); }); describe('toModelsContainer', () => { @@ -38,4 +39,4 @@ describe('ModelMappingService tests', () => { }); }); }); -}); \ No newline at end of file +}); diff --git a/package-lock.json b/package-lock.json index bd4cb4b..b02ce01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@luxbss/gengen", - "version": "1.0.0-rc.13", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@luxbss/gengen", - "version": "1.0.0-rc.13", + "version": "1.0.0", "license": "MIT", "dependencies": { "commander": "9.0.0", diff --git a/package.json b/package.json index 0495d79..53201da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@luxbss/gengen", - "version": "1.0.0-rc.13", + "version": "1.0.0", "description": "Tool for generating models and Angular services based on OpenAPIs and Swagger's JSON", "bin": { "gengen": "./bin/index.js"