From e4f45f900f0df0c10bc87c484fbf0634414e42af Mon Sep 17 00:00:00 2001 From: sumeyye Date: Tue, 20 Jan 2026 15:40:18 +0300 Subject: [PATCH] update: schematics package tests --- .../packages/schematics/src/test-setup.ts | 1 - .../src/tests/parse-generic-type.spec.ts | 60 ++++++++----------- 2 files changed, 26 insertions(+), 35 deletions(-) delete mode 100644 npm/ng-packs/packages/schematics/src/test-setup.ts diff --git a/npm/ng-packs/packages/schematics/src/test-setup.ts b/npm/ng-packs/packages/schematics/src/test-setup.ts deleted file mode 100644 index 1100b3e8a6..0000000000 --- a/npm/ng-packs/packages/schematics/src/test-setup.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest-preset-angular/setup-jest'; diff --git a/npm/ng-packs/packages/schematics/src/tests/parse-generic-type.spec.ts b/npm/ng-packs/packages/schematics/src/tests/parse-generic-type.spec.ts index 400fcdf6eb..4bf520e108 100644 --- a/npm/ng-packs/packages/schematics/src/tests/parse-generic-type.spec.ts +++ b/npm/ng-packs/packages/schematics/src/tests/parse-generic-type.spec.ts @@ -1,7 +1,6 @@ +import { expect, describe, it, test } from 'vitest'; import { parseBaseTypeWithGenericTypes } from '../utils/model'; -import { parseGenerics } from '../utils/tree'; - -import {test} from '@jest/globals'; +import { parseGenerics } from '../utils/tree'; const cases: Array<[string, string[]]> = [ [ @@ -17,7 +16,7 @@ const cases: Array<[string, string[]]> = [ [ 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto', 'string', - 'Volo.Abp.Identity.IdentityUserDto' + 'Volo.Abp.Identity.IdentityUserDto', ], ], [ @@ -39,41 +38,38 @@ const cases: Array<[string, string[]]> = [ 'System.String', ], ], - [ - 'AuditedEntityWithUserDto', - ['AuditedEntityWithUserDto'], - ], + ['AuditedEntityWithUserDto', ['AuditedEntityWithUserDto']], ]; test.each(cases)('should parse %s', (inputStr, expected) => { - const parsed = parseBaseTypeWithGenericTypes(inputStr); - expect(parsed).toEqual(expected); -}) + const parsed = parseBaseTypeWithGenericTypes(inputStr); + expect(parsed).toEqual(expected); +}); describe('parseGenerics', () => { - - it('should work with simple type', function() { + it('should work with simple type', function () { const node = parseGenerics('System.String'); expect(node.data).toEqual('System.String'); expect(node.index).toBe(0); expect(node.parent).toBe(null); }); - it('should work with simple Array type', function() { + it('should work with simple Array type', function () { const node = parseGenerics('System.String[]'); expect(node.data).toEqual('System.String[]'); expect(node.index).toBe(0); expect(node.parent).toBe(null); }); - it('should work with simple', function() { + it('should work with simple', function () { const node = parseGenerics('Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'); expect(node.data).toEqual('Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'); expect(node.index).toBe(0); expect(node.parent).toBe(null); }); - it('should work with `Volo.Abp.Application.Dtos.AuditedEntityWithUserDto`', function() { - const type = 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'; + it('should work with `Volo.Abp.Application.Dtos.AuditedEntityWithUserDto`', function () { + const type = + 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'; const node = parseGenerics(type); expect(node.data).toEqual('Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'); @@ -83,37 +79,37 @@ describe('parseGenerics', () => { expect(child.parent).toBe(node); }); - - it('should work with `Volo.Abp.Application.Dtos.AuditedEntityWithUserDto`', function() { - const type = 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'; + it('should work with `Volo.Abp.Application.Dtos.AuditedEntityWithUserDto`', function () { + const type = + 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'; const node = parseGenerics(type); expect(node.data).toEqual('Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'); expect(node.children.length).toBe(2); expect(node.children[0].data).toEqual('System.string'); - expect(node.children[0].index).toBe(0) + expect(node.children[0].index).toBe(0); expect(node.children[1].data).toEqual('Volo.Abp.Identity.IdentityUserDto'); expect(node.children[1].index).toBe(1); - }); - it('should Volo.Abp.Application.Dtos.AuditedEntityWithUserDto>', function() { - const type = 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto>'; + it('should Volo.Abp.Application.Dtos.AuditedEntityWithUserDto>', function () { + const type = + 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto>'; const node = parseGenerics(type); expect(node.data).toEqual('Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'); expect(node.children.length).toBe(2); expect(node.children[0].data).toEqual('System.string'); - expect((node.children[0]).parent).toBe(node); + expect(node.children[0].parent).toBe(node); expect(node.children[1].data).toEqual('Volo.Abp.Identity.IdentityUserDto'); expect(node.children[1].children.length).toBe(1); expect(node.children[1].children[0].data).toEqual('System.Int'); - expect(node.children[1].children[0].parent).toBe(node.children[1]) - expect(node.children[1].children[0].index).toBe(0) - + expect(node.children[1].children[0].parent).toBe(node.children[1]); + expect(node.children[1].children[0].index).toBe(0); }); - it('should Volo.Abp.Application.Dtos.AuditedEntityWithUserDto,System.string>', function() { - const type = 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto,System.string>'; + it('should Volo.Abp.Application.Dtos.AuditedEntityWithUserDto,System.string>', function () { + const type = + 'Volo.Abp.Application.Dtos.AuditedEntityWithUserDto,System.string>'; const node = parseGenerics(type); expect(node.data).toEqual('Volo.Abp.Application.Dtos.AuditedEntityWithUserDto'); expect(node.children.length).toBe(2); @@ -121,9 +117,5 @@ describe('parseGenerics', () => { expect(node.children[0].children.length).toBe(1); expect(node.children[0].children[0].data).toEqual('System.Int'); expect(node.children[1].data).toEqual('System.string'); - }); }); - - -