Skip to content

Commit 81a682f

Browse files
committed
refactor(events): rename bulkVisitEvent to bulkVisitEvents for consistency across the codebase
1 parent f2ab338 commit 81a682f

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/models/eventsFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ class EventsFactory extends Factory {
889889
* @param {string|ObjectId} userId - id of the user who is visiting events
890890
* @returns {Promise<{ updatedCount: number, updatedEventIds: string[], failedEventIds: string[] }>}
891891
*/
892-
async bulkVisitEvent(eventIds, userId) {
892+
async bulkVisitEvents(eventIds, userId) {
893893
const {
894894
collection,
895895
found,

src/resolvers/event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ module.exports = {
162162
}
163163

164164
const factory = getEventsFactory(context, projectId);
165-
const result = await factory.bulkVisitEvent(validEventIds, user.id);
165+
const result = await factory.bulkVisitEvents(validEventIds, user.id);
166166

167167
return {
168168
...result,

test/models/eventsFactory-bulk-visit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jest.mock('../../src/mongo', () => ({
3535
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-explicit-any -- CJS class
3636
const EventsFactory = require('../../src/models/eventsFactory') as any;
3737

38-
describe('EventsFactory.bulkVisitEvent', () => {
38+
describe('EventsFactory.bulkVisitEvents', () => {
3939
const projectId = '507f1f77bcf86cd799439011';
4040

4141
beforeEach(() => {
@@ -57,7 +57,7 @@ describe('EventsFactory.bulkVisitEvent', () => {
5757
});
5858
collectionMock.updateMany.mockResolvedValue({ modifiedCount: 1 });
5959

60-
const result = await factory.bulkVisitEvent([ a.toString(), b.toString() ], userId.toString());
60+
const result = await factory.bulkVisitEvents([ a.toString(), b.toString() ], userId.toString());
6161

6262
expect(result.updatedCount).toBe(1);
6363
expect(result.updatedEventIds).toEqual([ b.toString() ]);
@@ -72,7 +72,7 @@ describe('EventsFactory.bulkVisitEvent', () => {
7272
toArray: () => Promise.resolve([]),
7373
});
7474

75-
const result = await factory.bulkVisitEvent([ missing.toString() ], new ObjectId().toString());
75+
const result = await factory.bulkVisitEvents([ missing.toString() ], new ObjectId().toString());
7676

7777
expect(result.updatedCount).toBe(0);
7878
expect(result.updatedEventIds).toEqual([]);

test/resolvers/event-bulk-visit.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const eventResolvers = require('../../src/resolvers/event') as {
1717
};
1818
};
1919

20-
const bulkVisitEvent = jest.fn();
20+
const bulkVisitEvents = jest.fn();
2121

2222
describe('Mutation.bulkVisitEvents', () => {
2323
const ctx = {
@@ -26,11 +26,11 @@ describe('Mutation.bulkVisitEvents', () => {
2626

2727
beforeEach(() => {
2828
jest.clearAllMocks();
29-
(getEventsFactory as unknown as jest.Mock).mockReturnValue({ bulkVisitEvent });
29+
(getEventsFactory as unknown as jest.Mock).mockReturnValue({ bulkVisitEvents });
3030
});
3131

3232
it('should call factory with valid ids only and merge invalid ids', async () => {
33-
bulkVisitEvent.mockResolvedValue({
33+
bulkVisitEvents.mockResolvedValue({
3434
updatedCount: 1,
3535
updatedEventIds: [ '507f1f77bcf86cd799439012' ],
3636
failedEventIds: [ '507f1f77bcf86cd799439099' ],
@@ -42,7 +42,7 @@ describe('Mutation.bulkVisitEvents', () => {
4242
ctx
4343
);
4444

45-
expect(bulkVisitEvent).toHaveBeenCalledWith(
45+
expect(bulkVisitEvents).toHaveBeenCalledWith(
4646
[ '507f1f77bcf86cd799439012' ],
4747
'507f1f77bcf86cd799439011'
4848
);
@@ -60,7 +60,7 @@ describe('Mutation.bulkVisitEvents', () => {
6060
ctx
6161
);
6262

63-
expect(bulkVisitEvent).not.toHaveBeenCalled();
63+
expect(bulkVisitEvents).not.toHaveBeenCalled();
6464
expect(result).toEqual({
6565
updatedCount: 0,
6666
updatedEventIds: [],

0 commit comments

Comments
 (0)