From e84d71e5403675ce47e95f1a8e20ac54275861af Mon Sep 17 00:00:00 2001 From: ppetzold Date: Mon, 14 Mar 2022 18:48:56 +0100 Subject: [PATCH] restore jest style structure --- src/{test/entity => __tests__}/cat-home.entity.ts | 0 src/{test/entity => __tests__}/cat-toy.entity.ts | 0 src/{test/entity => __tests__}/cat.entity.ts | 0 src/{test => }/decorator.spec.ts | 2 +- src/{test => }/paginate.spec.ts | 14 +++++++++----- 5 files changed, 10 insertions(+), 6 deletions(-) rename src/{test/entity => __tests__}/cat-home.entity.ts (100%) rename src/{test/entity => __tests__}/cat-toy.entity.ts (100%) rename src/{test/entity => __tests__}/cat.entity.ts (100%) rename src/{test => }/decorator.spec.ts (98%) rename src/{test => }/paginate.spec.ts (99%) diff --git a/src/test/entity/cat-home.entity.ts b/src/__tests__/cat-home.entity.ts similarity index 100% rename from src/test/entity/cat-home.entity.ts rename to src/__tests__/cat-home.entity.ts diff --git a/src/test/entity/cat-toy.entity.ts b/src/__tests__/cat-toy.entity.ts similarity index 100% rename from src/test/entity/cat-toy.entity.ts rename to src/__tests__/cat-toy.entity.ts diff --git a/src/test/entity/cat.entity.ts b/src/__tests__/cat.entity.ts similarity index 100% rename from src/test/entity/cat.entity.ts rename to src/__tests__/cat.entity.ts diff --git a/src/test/decorator.spec.ts b/src/decorator.spec.ts similarity index 98% rename from src/test/decorator.spec.ts rename to src/decorator.spec.ts index e425037..7e6ace4 100644 --- a/src/test/decorator.spec.ts +++ b/src/decorator.spec.ts @@ -2,7 +2,7 @@ import { ROUTE_ARGS_METADATA } from '@nestjs/common/constants' import { HttpArgumentsHost, CustomParamFactory, ExecutionContext } from '@nestjs/common/interfaces' import { Request as ExpressRequest } from 'express' import { FastifyRequest } from 'fastify' -import { Paginate, PaginateQuery } from '../index' +import { Paginate, PaginateQuery } from './decorator' // eslint-disable-next-line @typescript-eslint/ban-types function getParamDecoratorFactory(decorator: Function): CustomParamFactory { diff --git a/src/test/paginate.spec.ts b/src/paginate.spec.ts similarity index 99% rename from src/test/paginate.spec.ts rename to src/paginate.spec.ts index df4be66..fcc1969 100644 --- a/src/test/paginate.spec.ts +++ b/src/paginate.spec.ts @@ -7,12 +7,12 @@ import { isOperator, getFilterTokens, OperatorSymbolToFunction, -} from '../index' -import { PaginateQuery } from '../index' +} from './paginate' +import { PaginateQuery } from './decorator' import { HttpException } from '@nestjs/common' -import { CatEntity } from './entity/cat.entity' -import { CatToyEntity } from './entity/cat-toy.entity' -import { CatHomeEntity } from './entity/cat-home.entity' +import { CatEntity } from './__tests__/cat.entity' +import { CatToyEntity } from './__tests__/cat-toy.entity' +import { CatHomeEntity } from './__tests__/cat-home.entity' import { clone } from 'lodash' describe('paginate', () => { @@ -217,6 +217,10 @@ describe('paginate', () => { expect(result.data).toStrictEqual([cats[3], cats[4], cats[1], cats[0], cats[2]]) }) + /** + * search + */ + it('should return result based on search term', async () => { const config: PaginateConfig = { sortableColumns: ['id', 'name', 'color'],