From cf9a3b13537b211b6228fed038afff52c66e8dee Mon Sep 17 00:00:00 2001 From: catalinfaurpaul Date: Mon, 23 Oct 2023 17:35:15 +0300 Subject: [PATCH] move common spec in unit/services --- .../common/protocol.common.e2e-spec.ts | 38 ------------------- ...private.app.module.controller.e2e-spec.ts} | 0 .../integration/services/caching.e2e-spec.ts | 2 - .../services/github.service.spec.ts} | 0 .../services/graphql.service.spec.ts} | 0 .../services/persistence.service.spec.ts} | 0 .../services/queue-worker.module.spec.ts} | 0 .../rabbit-mq-token-handler.service.spec.ts} | 0 .../rabbitmq-token.handle.service.spec.ts} | 0 .../services/rabbitmq.consumer.spec.ts} | 0 10 files changed, 40 deletions(-) delete mode 100644 src/test/integration/common/protocol.common.e2e-spec.ts rename src/test/integration/{common/private.app.module.e2e-spec.ts => controllers/private.app.module.controller.e2e-spec.ts} (100%) rename src/test/{integration/common/github.service.e2e-spec.ts => unit/services/github.service.spec.ts} (100%) rename src/test/{integration/common/graphql.service.e2e-spec.ts => unit/services/graphql.service.spec.ts} (100%) rename src/test/{integration/common/persistence.service.e2e-spec.ts => unit/services/persistence.service.spec.ts} (100%) rename src/test/{integration/common/queue-worker.module.e2e-spec.ts => unit/services/queue-worker.module.spec.ts} (100%) rename src/test/{integration/common/rabbit-mq-token-handler.service.e2e-spec.ts => unit/services/rabbit-mq-token-handler.service.spec.ts} (100%) rename src/test/{integration/common/rabbitmq-token.handle.service.e2e-spec.ts => unit/services/rabbitmq-token.handle.service.spec.ts} (100%) rename src/test/{integration/common/rabbitmq.consumer.e2e-spec.ts => unit/services/rabbitmq.consumer.spec.ts} (100%) diff --git a/src/test/integration/common/protocol.common.e2e-spec.ts b/src/test/integration/common/protocol.common.e2e-spec.ts deleted file mode 100644 index 71b7f0ccc..000000000 --- a/src/test/integration/common/protocol.common.e2e-spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Test } from "@nestjs/testing"; -import { ProtocolModule } from "src/common/protocol/protocol.module"; -import { CacheService } from "@multiversx/sdk-nestjs-cache"; -import { ProtocolService } from "src/common/protocol/protocol.service"; -import { EventEmitterModule } from "@nestjs/event-emitter"; - -describe('Protocol Service', () => { - let protocolService: ProtocolService; - - beforeAll(async () => { - const moduleRef = await Test.createTestingModule({ - imports: [EventEmitterModule.forRoot(), ProtocolModule], - providers: [], - }).compile(); - - protocolService = moduleRef.get(ProtocolService); - }); - - beforeEach(() => { jest.restoreAllMocks(); }); - - describe('Get Shards Ids', () => { - it('should return shards ids', async () => { - jest - .spyOn(CacheService.prototype, 'getOrSet') - .mockImplementation(jest.fn((_key: string, promise: any) => promise())); - - const shardsId = await protocolService.getShardIds(); - expect(shardsId).toStrictEqual([0, 1, 2, 4294967295]); - }); - }); - - describe('Get Seconds Remaining Until Next Round', () => { - it('should return the remaining seconds until next round', async () => { - const returnedSeconds = await protocolService.getSecondsRemainingUntilNextRound(); - expect(typeof returnedSeconds).toBe('number'); - }); - }); -}); diff --git a/src/test/integration/common/private.app.module.e2e-spec.ts b/src/test/integration/controllers/private.app.module.controller.e2e-spec.ts similarity index 100% rename from src/test/integration/common/private.app.module.e2e-spec.ts rename to src/test/integration/controllers/private.app.module.controller.e2e-spec.ts diff --git a/src/test/integration/services/caching.e2e-spec.ts b/src/test/integration/services/caching.e2e-spec.ts index 5635141f0..97e3b7d85 100644 --- a/src/test/integration/services/caching.e2e-spec.ts +++ b/src/test/integration/services/caching.e2e-spec.ts @@ -75,7 +75,5 @@ describe('Caching Service', () => { const cacheValueChunks = await cachingService.batchGetManyRemote(input.map((x) => cacheKeyFunction(x))); expect(cacheValueChunks).toStrictEqual(output); }); - }); - }); diff --git a/src/test/integration/common/github.service.e2e-spec.ts b/src/test/unit/services/github.service.spec.ts similarity index 100% rename from src/test/integration/common/github.service.e2e-spec.ts rename to src/test/unit/services/github.service.spec.ts diff --git a/src/test/integration/common/graphql.service.e2e-spec.ts b/src/test/unit/services/graphql.service.spec.ts similarity index 100% rename from src/test/integration/common/graphql.service.e2e-spec.ts rename to src/test/unit/services/graphql.service.spec.ts diff --git a/src/test/integration/common/persistence.service.e2e-spec.ts b/src/test/unit/services/persistence.service.spec.ts similarity index 100% rename from src/test/integration/common/persistence.service.e2e-spec.ts rename to src/test/unit/services/persistence.service.spec.ts diff --git a/src/test/integration/common/queue-worker.module.e2e-spec.ts b/src/test/unit/services/queue-worker.module.spec.ts similarity index 100% rename from src/test/integration/common/queue-worker.module.e2e-spec.ts rename to src/test/unit/services/queue-worker.module.spec.ts diff --git a/src/test/integration/common/rabbit-mq-token-handler.service.e2e-spec.ts b/src/test/unit/services/rabbit-mq-token-handler.service.spec.ts similarity index 100% rename from src/test/integration/common/rabbit-mq-token-handler.service.e2e-spec.ts rename to src/test/unit/services/rabbit-mq-token-handler.service.spec.ts diff --git a/src/test/integration/common/rabbitmq-token.handle.service.e2e-spec.ts b/src/test/unit/services/rabbitmq-token.handle.service.spec.ts similarity index 100% rename from src/test/integration/common/rabbitmq-token.handle.service.e2e-spec.ts rename to src/test/unit/services/rabbitmq-token.handle.service.spec.ts diff --git a/src/test/integration/common/rabbitmq.consumer.e2e-spec.ts b/src/test/unit/services/rabbitmq.consumer.spec.ts similarity index 100% rename from src/test/integration/common/rabbitmq.consumer.e2e-spec.ts rename to src/test/unit/services/rabbitmq.consumer.spec.ts