Skip to content

Commit

Permalink
feat: convert instance to shelf (#656)
Browse files Browse the repository at this point in the history
Signed-off-by: hxtree <[email protected]>
  • Loading branch information
hxtree authored Nov 14, 2023
1 parent aa017fe commit 8c95063
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
10 changes: 3 additions & 7 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "8f84bcec187c6c38f8c579af0995a4d986965600",
"pnpmShrinkwrapHash": "123131887fff63d0fad3a107611cb727e7c192f7",
"preferredVersionsHash": "7c6836c4ff2ee31a263e87ea93a487fc752ca3f6"
}
24 changes: 23 additions & 1 deletion services/instances/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
{
"preset": "./node_modules/@cats-cradle/base-nodejs/profiles/nestjs-app/jest.config.json"
"preset": "@shelf/jest-mongodb",
"roots": ["<rootDir>/src/", "<rootDir>/stacks/"],
"testMatch": [
"<rootDir>/src/**/*.{test,e2e-spec}.ts",
"<rootDir>/src/__tests__/**/*.test.ts",
"<rootDir>/stacks/**/*.test.ts"
],
"testPathIgnorePatterns": ["/node_modules/"],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"collectCoverageFrom": [
"<rootDir>/src/**/*.ts",
"<rootDir>/stacks/**/*.ts",
"!<rootDir>/src/index.ts",
"!<rootDir>/src/**/*.module.ts",
"!<rootDir>/src/main.ts",
"!<rootDir>/src/app.ts",
"!<rootDir>/src/**/index.ts",
"!<rootDir>/src/**/data/**"
],
"coverageReporters": ["json", "text-summary"],
"coverageDirectory": "<rootDir>/coverage"
}
3 changes: 2 additions & 1 deletion services/instances/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"@nestjs/config": "2.2.0",
"@cats-cradle/create-bundle": "1.0.7",
"@nestjs/mongoose": "9.2.1",
"mongoose": "6.9.1"
"mongoose": "6.9.1",
"@shelf/jest-mongodb": "~4.1.7"
},
"devDependencies": {
"aws-cdk-lib": "2.95.0",
Expand Down
7 changes: 5 additions & 2 deletions services/instances/src/module/instances/instance.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import supertest from 'supertest';
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import {
rootMongooseTestModule,
MongooseModule,
closeInMongodConnection,
asyncForEach,
Expand All @@ -21,7 +20,11 @@ describe('/instances', () => {
beforeAll(async () => {
const moduleRef: TestingModule = await Test.createTestingModule({
imports: [
rootMongooseTestModule(),
MongooseModule.forRootAsync({
useFactory: async () => ({
uri: process.env.MONGO_DATABASE_URI,
}),
}),
MongooseModule.forFeature([
{ name: 'Instance', schema: InstanceSchema },
]),
Expand Down

0 comments on commit 8c95063

Please sign in to comment.