Refactor to accommodate authentication, transaction and pagination states together (#4636)
* fix: refactor to accommodate authentication, transaction and pagination together into ctx.state * feat: allow passing response type to APIContext
This commit is contained in:
@@ -24,7 +24,7 @@ describe("Authentication middleware", () => {
|
||||
},
|
||||
jest.fn()
|
||||
);
|
||||
expect(state.user.id).toEqual(user.id);
|
||||
expect(state.auth.user.id).toEqual(user.id);
|
||||
});
|
||||
|
||||
it("should return error with invalid token", async () => {
|
||||
@@ -68,7 +68,7 @@ describe("Authentication middleware", () => {
|
||||
},
|
||||
jest.fn()
|
||||
);
|
||||
expect(state.user.id).toEqual(user.id);
|
||||
expect(state.auth.user.id).toEqual(user.id);
|
||||
});
|
||||
it("should return error with invalid API key", async () => {
|
||||
const state = {} as DefaultState;
|
||||
@@ -133,7 +133,7 @@ describe("Authentication middleware", () => {
|
||||
},
|
||||
jest.fn()
|
||||
);
|
||||
expect(state.user.id).toEqual(user.id);
|
||||
expect(state.auth.user.id).toEqual(user.id);
|
||||
});
|
||||
|
||||
it("should allow passing auth token in body params", async () => {
|
||||
@@ -154,7 +154,7 @@ describe("Authentication middleware", () => {
|
||||
},
|
||||
jest.fn()
|
||||
);
|
||||
expect(state.user.id).toEqual(user.id);
|
||||
expect(state.auth.user.id).toEqual(user.id);
|
||||
});
|
||||
|
||||
it("should return an error for suspended users", async () => {
|
||||
|
||||
Reference in New Issue
Block a user