doll active state <-> doll stream toggle

This commit is contained in:
2025-12-23 09:16:27 +08:00
parent cd71e97655
commit 6c63f2d803
8 changed files with 151 additions and 13 deletions

View File

@@ -34,7 +34,10 @@ describe('DollsService', () => {
friendship: {
findMany: jest.fn().mockResolvedValue([]),
},
$transaction: jest.fn((callback) => callback(mockPrismaService)),
$transaction: jest.fn((callback) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return callback(mockPrismaService);
}),
user: {
updateMany: jest.fn().mockResolvedValue({ count: 1 }),
},
@@ -72,6 +75,13 @@ describe('DollsService', () => {
const createDto = { name: 'New Doll' };
const userId = 'user-1';
// Mock the transaction callback to return the doll
jest
.spyOn(prismaService, '$transaction')
.mockImplementation(async (callback) => {
return callback(prismaService);
});
await service.create(userId, createDto);
expect(prismaService.doll.create).toHaveBeenCalledWith({