Skip to content
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

Merged

Conversation

devAyushDubey
Copy link
Contributor

Mentions #109
Tracked by #95

@devAyushDubey devAyushDubey changed the title Fixed Test - Adapter Service adapter.controller.service.ts Fixed Test - Adapter Service adapter.service.spec.ts Jun 9, 2023
Comment on lines 31 to 62
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,
};
}),
},
Copy link
Member

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.

Copy link
Contributor Author

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!

@chinmoy12c chinmoy12c changed the base branch from master to develop June 16, 2023 10:41
@RyanWalker277 RyanWalker277 mentioned this pull request Jun 20, 2023
21 tasks
@chinmoy12c chinmoy12c merged commit 842d823 into samagra-comms:develop Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants