Skip to content

Commit

Permalink
ci(test): test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Apr 28, 2024
1 parent 09dd835 commit 517a1c5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ APP_SOURCE=https://github.com/AthennaIO
LOG_HTTP=false
LOG_CHANNEL=stack

DB_CONNECTION=fake
DB_CONNECTION=postgres
DB_HOST=localhost
DB_PORT=5432
DB_DEBUG=false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: npm install

- name: Run migrations and seeders
run: node artisan db:fresh --with-seeders --env test --connection postgres
run: node artisan db:fresh --with-seeders --env test

- name: Run tests
run: npm run test:coverage
Expand Down
4 changes: 0 additions & 4 deletions tests/e2e/auth.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { Test, type Context, AfterAll, BeforeAll } from '@athenna/test'
export default class AuthControllerTest extends BaseHttpTest {
@BeforeAll()
public async beforeAll() {
Config.set('database.default', 'postgres')

await Database.runSeeders()
}

Expand All @@ -21,8 +19,6 @@ export default class AuthControllerTest extends BaseHttpTest {
await Role.truncate()
await RoleUser.truncate()
await Database.close()

Config.set('database.default', Env('DB_CONNECTION', 'fake'))
}

@Test()
Expand Down
4 changes: 0 additions & 4 deletions tests/e2e/user.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { Test, type Context, AfterEach, BeforeEach } from '@athenna/test'
export default class UserControllerTest extends BaseHttpTest {
@BeforeEach()
public async beforeEach() {
Config.set('database.default', 'postgres')

await Database.runSeeders()
}

Expand All @@ -21,8 +19,6 @@ export default class UserControllerTest extends BaseHttpTest {
await Role.truncate()
await RoleUser.truncate()
await Database.close()

Config.set('database.default', Env('DB_CONNECTION', 'fake'))
}

@Test()
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/auth.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ export default class AuthServiceTest {

@BeforeEach()
public beforeEach() {
Config.set('database.default', 'fake')

this.userService = new UserService()
}

@AfterEach()
public afterEach() {
Config.set('database.default', Env('DB_CONNECTION', 'postgres'))

Mock.restoreAll()
}

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/user.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import { Test, type Context, Mock, BeforeEach, AfterEach } from '@athenna/test'
export default class UserServiceTest {
@BeforeEach()
public beforeEach() {
Config.set('database.default', 'fake')

new DatabaseProvider().register()
}

@AfterEach()
public afterEach() {
Config.set('database.default', Env('DB_CONNECTION', 'postgres'))

Mock.restoreAll()
}

Expand Down

0 comments on commit 517a1c5

Please sign in to comment.