Skip to content

Commit

Permalink
test(config): disable validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Apr 29, 2024
1 parent 630fd6b commit bd86a69
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@athenna/common": "^4.36.0",
"@athenna/config": "^4.20.0",
"@athenna/core": "^4.37.0",
"@athenna/database": "^4.48.0",
"@athenna/database": "^4.49.0",
"@athenna/http": "^4.32.0",
"@athenna/ioc": "^4.19.0",
"@athenna/logger": "^4.20.0",
Expand Down
6 changes: 5 additions & 1 deletion src/config/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export default {

fake: {
driver: 'fake',
validations: false
validations: {
isToSetAttributes: true,
isToValidateUnique: false,
isToValidateNullable: false
}
}
}
}
9 changes: 1 addition & 8 deletions tests/unit/user.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ export default class UserServiceTest {
}
const fakeUser = await User.factory().count(1).make(userToCreate)

Mock.when(Database.driver, 'find')
.onFirstCall()
.resolve(undefined)
.onSecondCall()
.resolve({ id: 1, name: RoleEnum.CUSTOMER })

Mock.when(Database.driver, 'find').resolve({ id: 1, name: RoleEnum.CUSTOMER })
Mock.when(Database.driver, 'createMany').resolve([fakeUser])

const user = await new UserService().create(userToCreate)
Expand Down Expand Up @@ -116,7 +111,6 @@ export default class UserServiceTest {
}
const fakeUser = await User.factory().count(1).make(userToUpdate)

Mock.when(Database.driver, 'find').resolve(undefined)
Mock.when(Database.driver, 'update').resolve(fakeUser)

await new UserService().update(1, userToUpdate)
Expand All @@ -133,7 +127,6 @@ export default class UserServiceTest {
}
const fakeUser = await User.factory().count(1).make(userToUpdate)

Mock.when(Database.driver, 'find').resolve(undefined)
Mock.when(Database.driver, 'update').resolve(fakeUser)

await new UserService().update(1, userToUpdate)
Expand Down

0 comments on commit bd86a69

Please sign in to comment.