From 832383eabd24ddd47461fb42ebe705957c5483ca Mon Sep 17 00:00:00 2001 From: Lakshay saini Date: Fri, 29 Dec 2023 23:53:53 +0530 Subject: [PATCH] refactor: move mock data folder inside common module --- apps/api/src/{ => common}/mock-data/users.ts | 12 ++---------- apps/api/src/user/fake.repository.ts | 2 +- apps/api/src/user/user.controller.spec.ts | 2 +- apps/api/src/user/user.service.spec.ts | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) rename apps/api/src/{ => common}/mock-data/users.ts (81%) diff --git a/apps/api/src/mock-data/users.ts b/apps/api/src/common/mock-data/users.ts similarity index 81% rename from apps/api/src/mock-data/users.ts rename to apps/api/src/common/mock-data/users.ts index 133014e9..a779a3c6 100644 --- a/apps/api/src/mock-data/users.ts +++ b/apps/api/src/common/mock-data/users.ts @@ -1,15 +1,5 @@ import { User } from '@prisma/client' -export const user: User = { - id: '1', - name: 'John Doe', - email: 'johndoe@keyshade.xyz', - profilePictureUrl: 'https://keyshade.xyz/johndoe.jpg', - isActive: true, - isOnboardingFinished: false, - isAdmin: false -} - export const users: Array = [ { id: '1', @@ -48,3 +38,5 @@ export const users: Array = [ isAdmin: true } ] + +export const user: User = users[0] diff --git a/apps/api/src/user/fake.repository.ts b/apps/api/src/user/fake.repository.ts index 20d0360d..5593cb7b 100644 --- a/apps/api/src/user/fake.repository.ts +++ b/apps/api/src/user/fake.repository.ts @@ -1,6 +1,6 @@ import { User } from '@prisma/client' import { PrismaRepository } from '../prisma/prisma.repository' -import { users } from '../mock-data/users' +import { users } from '../common/mock-data/users' export const fakeRepository: Partial = { async excludeFields( diff --git a/apps/api/src/user/user.controller.spec.ts b/apps/api/src/user/user.controller.spec.ts index b4e4297f..f61b110b 100644 --- a/apps/api/src/user/user.controller.spec.ts +++ b/apps/api/src/user/user.controller.spec.ts @@ -3,7 +3,7 @@ import { UserController } from './user.controller' import { UserService } from './user.service' import { fakeRepository } from './fake.repository' import { User } from '@prisma/client' -import { users } from '../mock-data/users' +import { users } from '../common/mock-data/users' describe('UserController', () => { let controller: UserController diff --git a/apps/api/src/user/user.service.spec.ts b/apps/api/src/user/user.service.spec.ts index d408d367..9baf0ee6 100644 --- a/apps/api/src/user/user.service.spec.ts +++ b/apps/api/src/user/user.service.spec.ts @@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing' import { UserService } from './user.service' import { fakeRepository } from './fake.repository' import { User } from '@prisma/client' -import { users } from '../mock-data/users' +import { users } from '../common/mock-data/users' describe('UserService', () => { let service: UserService