| 1 | import { Agent } from './agent'; |
| 2 | import { AuthService } from '../src/auth/auth.service'; |
| 3 | import { user } from './mockData'; |
| 4 | import { initApp } from './app'; |
| 5 | |
| 6 | beforeAll(async () => { |
| 7 | const app = await initApp(); |
| 8 | |
| 9 | await Agent.initialize(app); |
| 10 | |
| 11 | const authService = app.get(AuthService); |
| 12 | const token = await authService.generateToken({ |
| 13 | id: user._id.toString(), |
| 14 | name: user.name, |
| 15 | phone: user.phone, |
| 16 | }); |
| 17 | |
| 18 | Agent.login(token); |
| 19 | }); |
| 20 | |
| 21 | afterAll(async () => { |
| 22 | await Agent.app().close(); |
| 23 | }); |
| 24 |