forked from akadirishogo/alx-files_manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbClient.test.js
More file actions
28 lines (23 loc) · 767 Bytes
/
dbClient.test.js
File metadata and controls
28 lines (23 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Import the DBClient instance from db.js
const dbClient = require('./utils/db');
describe('DBClient', () => {
// Before running any tests, connect to the database
beforeAll(async () => {
await dbClient.connect();
});
// After all tests, close the database connection
afterAll(async () => {
await dbClient.close();
});
it('should connect to the database', () => {
expect(dbClient.isAlive()).toBe(true);
});
it('should retrieve the number of users', async () => {
const userCount = await dbClient.nbUsers();
expect(userCount).toBeGreaterThanOrEqual(0);
});
it('should retrieve the number of files', async () => {
const fileCount = await dbClient.nbFiles();
expect(fileCount).toBeGreaterThanOrEqual(0);
});
});