-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
172 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import 'dotenv/config' | ||
import * as DatabaseHelper from '../src/common/DatabaseHelper' | ||
import * as TestHelper from './TestHelper' | ||
|
||
let SUPPLIER_ID: string | ||
let LOCATION_ID: string | ||
|
||
// | ||
// Connecting and initializing the database before running the test suite | ||
// | ||
beforeAll(async () => { | ||
if (await DatabaseHelper.Connect(false)) { | ||
await TestHelper.initializeDatabase() | ||
|
||
// create a agency | ||
const agencyName = TestHelper.getAgencyName() | ||
SUPPLIER_ID = await TestHelper.createAgency(`${agencyName}@test.bookcars.ma`, agencyName) | ||
|
||
// create a location | ||
LOCATION_ID = await TestHelper.createLocation('Location 1 EN', 'Location 1 FR') | ||
} | ||
}) | ||
|
||
// | ||
// Closing and cleaning the database connection after running the test suite | ||
// | ||
afterAll(async () => { | ||
await TestHelper.clearDatabase() | ||
|
||
// delete the agency | ||
await TestHelper.deleteAgency(SUPPLIER_ID) | ||
|
||
// delete the location | ||
await TestHelper.deleteLocation(LOCATION_ID) | ||
|
||
await DatabaseHelper.Close(false) | ||
}) | ||
|
||
// | ||
// Unit tests | ||
// | ||
|
||
describe('POST /api/create-booking', () => { | ||
it('should create a booking', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('POST /api/book', () => { | ||
it('should checkout', async () => { | ||
const token = await TestHelper.signinAsUser() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('POST /api/update-booking', () => { | ||
it('should update a booking', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('POST /api/update-booking-status', () => { | ||
it('should update booking status', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('GET /api/booking/:id/:language', () => { | ||
it('should get a booking', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('GET /api/bookings/:page/:size/:language', () => { | ||
it('should get bookings', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('GET /api/has-bookings/:driver', () => { | ||
it("should check driver's bookings", async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('POST /api/cancel-booking/:driver', () => { | ||
it('should cancel a booking', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) | ||
|
||
describe('DELETE /api/delete-bookings', () => { | ||
it('should delete bookings', async () => { | ||
const token = await TestHelper.signinAsAdmin() | ||
|
||
// TODO | ||
|
||
await TestHelper.signout(token) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters