mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 23:30:10 +00:00
fix database connect
This commit is contained in:
parent
18461d58d6
commit
fed9ab4621
@ -23,15 +23,7 @@ type ObjectIdOrNull = ObjectID | null;
|
|||||||
describe('ProjectMiddleware', () => {
|
describe('ProjectMiddleware', () => {
|
||||||
const mockedObjectId: ObjectID = ObjectID.generate();
|
const mockedObjectId: ObjectID = ObjectID.generate();
|
||||||
|
|
||||||
let database!: Database;
|
|
||||||
beforeEach(async () => {
|
|
||||||
database = new Database();
|
|
||||||
await database.createAndConnect();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
await database.disconnectAndDropDatabase();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getProjectId', () => {
|
describe('getProjectId', () => {
|
||||||
describe("should return value when tenantid is passed in the request's", () => {
|
describe("should return value when tenantid is passed in the request's", () => {
|
||||||
@ -164,8 +156,16 @@ describe('ProjectMiddleware', () => {
|
|||||||
id: mockedObjectId,
|
id: mockedObjectId,
|
||||||
} as ApiKey;
|
} as ApiKey;
|
||||||
|
|
||||||
beforeEach(() => {
|
let database!: Database;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
next = jest.fn();
|
next = jest.fn();
|
||||||
|
database = new Database();
|
||||||
|
await database.createAndConnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await database.disconnectAndDropDatabase();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
@ -189,7 +189,7 @@ describe('ProjectMiddleware', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(next).toHaveBeenCalledWith(
|
expect(next).toHaveBeenCalledWith(
|
||||||
new BadDataException('ProjectId not found in the request')
|
new BadDataException('ProjectID not found in the request header.')
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(spyGetProjectId).toHaveBeenCalledWith(req);
|
expect(spyGetProjectId).toHaveBeenCalledWith(req);
|
||||||
|
Loading…
Reference in New Issue
Block a user