-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Test - Adapter Service adapter.service.spec.ts
#111
Fixed Test - Adapter Service adapter.service.spec.ts
#111
Conversation
adapter.controller.service.ts
adapter.service.spec.ts
useValue: { | ||
adapter: { | ||
create: jest.fn(async (adapterDTO) => { | ||
return { | ||
id: 'mockID', | ||
createdAt: 1000000000000, | ||
updatedAt: 1000000000000, | ||
channel: adapterDTO.data.channel, | ||
provider: adapterDTO.data.provider, | ||
config: adapterDTO.data.config, | ||
name: adapterDTO.data.name, | ||
}; | ||
}), | ||
findMany: jest.fn().mockReturnValue([ | ||
{ | ||
...mockAdapter, | ||
}, | ||
]), | ||
findUnique: jest.fn((filter) => { | ||
const res = { ...mockAdapter }; | ||
res.id = filter.where.id; | ||
return res; | ||
}), | ||
update: jest.fn((payload) => { | ||
return { | ||
id: payload.where.id, | ||
createdAt: 1000000000000, | ||
updatedAt: 1000000000000, | ||
...payload.data, | ||
}; | ||
}), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract the mock implementation above beforeEach
? Looks a bit cleaner that way, as this mock implementation might increase in size later, as needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, can you review the recent changes. Thanks!
Mentions #109
Tracked by #95