Skip to content

Commit

Permalink
refactor: move mock data folder inside common module
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshay saini committed Dec 29, 2023
1 parent 333559d commit 832383e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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<User> = [
{
id: '1',
Expand Down Expand Up @@ -48,3 +38,5 @@ export const users: Array<User> = [
isAdmin: true
}
]

export const user: User = users[0]
2 changes: 1 addition & 1 deletion apps/api/src/user/fake.repository.ts
Original file line number Diff line number Diff line change
@@ -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<PrismaRepository> = {
async excludeFields<T, K extends keyof T>(
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/user/user.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/user/user.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 832383e

Please sign in to comment.