Skip to content

Commit f1bce1b

Browse files
committed
function's name
1 parent 3ae908f commit f1bce1b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/__tests__/notificationapi.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
CreateSubNotificationRequest,
99
DeleteSubNotificationRequest,
1010
InAppNotificationPatchRequest,
11-
LogQueryPostBody,
11+
queryLogsPostBody,
1212
PushProviders,
1313
SendRequest,
1414
SetUserPreferencesRequest,
@@ -318,13 +318,13 @@ describe('send', () => {
318318
);
319319
});
320320
});
321-
describe('logQuery', () => {
322-
const logQueryEndPointRegex = /.*\/logs\/query/;
321+
describe('queryLogs', () => {
322+
const queryLogsEndPointRegex = /.*\/logs\/query/;
323323
const clientId = 'testClientId';
324324
const clientSecret = 'testClientSecret';
325325

326326
test('makes API calls to the correct end-point, non custom', async () => {
327-
const nonCostumeQuery: LogQueryPostBody = {
327+
const nonCostumeQuery: queryLogsPostBody = {
328328
dateRangeFilter: { startTime: 1715904000000, endTime: 1718668799999 },
329329
notificationFilter: ['test'],
330330
channelFilter: [Channels.CALL],
@@ -333,24 +333,24 @@ describe('logQuery', () => {
333333
trackingIds: ['e2d6987f-52c'],
334334
envIdFilter: [clientId]
335335
};
336-
axiosMock.onPost(logQueryEndPointRegex).reply(200);
336+
axiosMock.onPost(queryLogsEndPointRegex).reply(200);
337337
notificationapi.init(clientId, clientSecret);
338-
await notificationapi.logQuery(nonCostumeQuery);
338+
await notificationapi.queryLogs(nonCostumeQuery);
339339
expect(axiosMock.history.post).toHaveLength(1);
340340
expect(axiosMock.history.post[0].url).toEqual(
341341
`https://api.notificationapi.com/${clientId}/logs/query`
342342
);
343343
expect(JSON.parse(axiosMock.history.post[0].data)).toEqual(nonCostumeQuery);
344344
});
345345
test('makes API calls to the correct end-point, custom', async () => {
346-
const nonCostumeQuery: LogQueryPostBody = {
346+
const nonCostumeQuery: queryLogsPostBody = {
347347
dateRangeFilter: { startTime: 1715904000000, endTime: 1718668799999 },
348348
customFilter:
349349
'fields @message| filter @logStream like /NotificationsSummary/| sort @timestamp desc'
350350
};
351-
axiosMock.onPost(logQueryEndPointRegex).reply(200);
351+
axiosMock.onPost(queryLogsEndPointRegex).reply(200);
352352
notificationapi.init(clientId, clientSecret);
353-
await notificationapi.logQuery(nonCostumeQuery);
353+
await notificationapi.queryLogs(nonCostumeQuery);
354354
expect(axiosMock.history.post).toHaveLength(1);
355355
expect(axiosMock.history.post[0].url).toEqual(
356356
`https://api.notificationapi.com/${clientId}/logs/query`

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export interface InAppNotificationPatchRequest {
167167
message: string;
168168
};
169169
}
170-
export interface LogQueryPostBody {
170+
export interface queryLogsPostBody {
171171
dateRangeFilter?: {
172172
startTime?: number;
173173
endTime?: number;

src/notificationapi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
DeleteSubNotificationRequest,
44
InAppNotificationPatchRequest,
55
InitConfiguration,
6-
LogQueryPostBody,
6+
queryLogsPostBody,
77
RetractRequest,
88
SendRequest,
99
SetUserPreferencesRequest,
@@ -71,7 +71,7 @@ class NotificationAPIService {
7171
return this.request('POST', 'sender/retract', retractRequest);
7272
};
7373
/** create a query on logs */
74-
logQuery = async (params: LogQueryPostBody): Promise<AxiosResponse> => {
74+
queryLogs = async (params: queryLogsPostBody): Promise<AxiosResponse> => {
7575
return this.request('POST', 'logs/query', params);
7676
};
7777
/** Used to create a subNotification of a specified notification. */

0 commit comments

Comments
 (0)