Compare commits
1 Commits
feat/ci-au
...
fix/interc
| Author | SHA1 | Date | |
|---|---|---|---|
| f3477b7501 |
@@ -384,10 +384,18 @@ describe("ActivityLoggingInterceptor", () => {
|
|||||||
const context = createMockExecutionContext("POST", {}, body, user);
|
const context = createMockExecutionContext("POST", {}, body, user);
|
||||||
const next = createMockCallHandler(result);
|
const next = createMockCallHandler(result);
|
||||||
|
|
||||||
|
mockActivityService.logActivity.mockResolvedValue({
|
||||||
|
id: "activity-123",
|
||||||
|
});
|
||||||
|
|
||||||
await new Promise<void>((resolve) => {
|
await new Promise<void>((resolve) => {
|
||||||
interceptor.intercept(context, next).subscribe(() => {
|
interceptor.intercept(context, next).subscribe(() => {
|
||||||
// Should not call logActivity when workspaceId is missing
|
// workspaceId is now optional, so logActivity should be called without it
|
||||||
expect(mockActivityService.logActivity).not.toHaveBeenCalled();
|
expect(mockActivityService.logActivity).toHaveBeenCalled();
|
||||||
|
const callArgs = mockActivityService.logActivity.mock.calls[0][0];
|
||||||
|
expect(callArgs.userId).toBe("user-123");
|
||||||
|
expect(callArgs.entityId).toBe("task-123");
|
||||||
|
expect(callArgs.workspaceId).toBeUndefined();
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -412,10 +420,18 @@ describe("ActivityLoggingInterceptor", () => {
|
|||||||
const context = createMockExecutionContext("POST", {}, body, user);
|
const context = createMockExecutionContext("POST", {}, body, user);
|
||||||
const next = createMockCallHandler(result);
|
const next = createMockCallHandler(result);
|
||||||
|
|
||||||
|
mockActivityService.logActivity.mockResolvedValue({
|
||||||
|
id: "activity-123",
|
||||||
|
});
|
||||||
|
|
||||||
await new Promise<void>((resolve) => {
|
await new Promise<void>((resolve) => {
|
||||||
interceptor.intercept(context, next).subscribe(() => {
|
interceptor.intercept(context, next).subscribe(() => {
|
||||||
// Should not call logActivity when workspaceId is missing
|
// workspaceId is now optional, so logActivity should be called without it
|
||||||
expect(mockActivityService.logActivity).not.toHaveBeenCalled();
|
expect(mockActivityService.logActivity).toHaveBeenCalled();
|
||||||
|
const callArgs = mockActivityService.logActivity.mock.calls[0][0];
|
||||||
|
expect(callArgs.userId).toBe("user-123");
|
||||||
|
expect(callArgs.entityId).toBe("task-123");
|
||||||
|
expect(callArgs.workspaceId).toBeUndefined();
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user