Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asein-sinch committed Sep 23, 2024
1 parent ca866ad commit 369151c
Showing 1 changed file with 9 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ When('I send a request to trigger a "CAPABILITY" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CAPABILITY" contains a valid signature', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Then('the header of the Conversation event {string} contains a valid signature', (_event) => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Expand All @@ -43,10 +44,6 @@ When('I send a request to trigger a "CONTACT_CREATE" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONTACT_CREATE" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONTACT_CREATE" event type', () => {
const contactCreateEvent = event as Conversation.ContactCreateEvent;
assert.ok(contactCreateEvent.contact_create_notification);
Expand All @@ -59,10 +56,6 @@ When('I send a request to trigger a "CONTACT_DELETE" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONTACT_DELETE" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONTACT_DELETE" event type', () => {
const contactDeleteEvent = event as Conversation.ContactDeleteEvent;
assert.ok(contactDeleteEvent.contact_delete_notification);
Expand All @@ -75,10 +68,6 @@ When('I send a request to trigger a "CONTACT_MERGE" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONTACT_MERGE" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONTACT_MERGE" event type', () => {
const contactMergeEvent = event as Conversation.ContactMergeEvent;
assert.ok(contactMergeEvent.contact_merge_notification);
Expand All @@ -91,10 +80,6 @@ When('I send a request to trigger a "CONTACT_UPDATE" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONTACT_UPDATE" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONTACT_UPDATE" event type', () => {
const contactUpdateEvent = event as Conversation.ContactUpdateEvent;
assert.ok(contactUpdateEvent.contact_update_notification);
Expand All @@ -107,10 +92,6 @@ When('I send a request to trigger a "CONVERSATION_DELETE" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONVERSATION_DELETE" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONVERSATION_DELETE" event type', () => {
const conversationDeleteEvent = event as Conversation.ConversationDeleteEvent;
assert.ok(conversationDeleteEvent.conversation_delete_notification);
Expand All @@ -123,10 +104,6 @@ When('I send a request to trigger a "CONVERSATION_START" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONVERSATION_START" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONVERSATION_START" event type', () => {
const conversationStartEvent = event as Conversation.ConversationStartEvent;
assert.ok(conversationStartEvent.conversation_start_notification);
Expand All @@ -139,10 +116,6 @@ When('I send a request to trigger a "CONVERSATION_STOP" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "CONVERSATION_STOP" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "CONVERSATION_STOP" event type', () => {
const conversationStopEvent = event as Conversation.ConversationStopEvent;
assert.ok(conversationStopEvent.conversation_stop_notification);
Expand All @@ -155,7 +128,8 @@ When('I send a request to trigger a "EVENT_DELIVERY" event with a "FAILED" statu
await processEvent(response);
});

Then('the header of the Conversation event "EVENT_DELIVERY" with a "FAILED" status contains a valid signature', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Then('the header of the Conversation event {} with a {} status contains a valid signature', (_event, _status) => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Expand All @@ -180,20 +154,11 @@ When('I send a request to trigger a "EVENT_DELIVERY" event with a "DELIVERED" st
await processEvent(response);
});

// eslint-disable-next-line max-len
Then('the header of the Conversation event "EVENT_DELIVERY" with a "DELIVERED" status contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

When('I send a request to trigger a "EVENT_INBOUND" event', async () => {
const response = await fetch('http://localhost:3014/webhooks/conversation/event-inbound');
await processEvent(response);
});

Then('the header of the Conversation event "EVENT_INBOUND" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "EVENT_INBOUND" event type', () => {
const eventInbound = event as Conversation.EventInbound;
assert.ok(eventInbound.event);
Expand All @@ -206,21 +171,11 @@ When('I send a request to trigger a "MESSAGE_DELIVERY" event with a "FAILED" sta
await processEvent(response);
});

// eslint-disable-next-line max-len
Then('the header of the Conversation event "MESSAGE_DELIVERY" with a "FAILED" status contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

When('I send a request to trigger a "MESSAGE_DELIVERY" event with a "QUEUED" status', async () => {
When('I send a request to trigger a "MESSAGE_DELIVERY" event with a "QUEUED_ON_CHANNEL" status', async () => {
const response = await fetch('http://localhost:3014/webhooks/conversation/message-delivery-report/succeeded');
await processEvent(response);
});

// eslint-disable-next-line max-len
Then('the header of the Conversation event "MESSAGE_DELIVERY" with a "QUEUED" status contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "MESSAGE_DELIVERY" event type', () => {
const messageDeliveryReceiptEvent = event as Conversation.MessageDeliveryReceiptEvent;
assert.ok(messageDeliveryReceiptEvent.message_delivery_report);
Expand All @@ -242,10 +197,6 @@ When('I send a request to trigger a "MESSAGE_INBOUND" event', async () => {
await processEvent(response);
});

Then('the header of the Conversation event "MESSAGE_INBOUND" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "MESSAGE_INBOUND" event type', () => {
const messageInboundEvent = event as Conversation.MessageInboundEvent;
assert.ok(messageInboundEvent.message);
Expand All @@ -258,11 +209,6 @@ When('I send a request to trigger a "MESSAGE_INBOUND_SMART_CONVERSATION_REDACTIO
await processEvent(response);
});

// eslint-disable-next-line max-len
Then('the header of the Conversation event "MESSAGE_INBOUND_SMART_CONVERSATION_REDACTION" contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "MESSAGE_INBOUND_SMART_CONVERSATION_REDACTION" event type', () => {
const messageInboundSmartConversationRedactionEvent
= event as Conversation.MessageInboundSmartConversationRedactionEvent;
Expand All @@ -276,7 +222,8 @@ When('I send a request to trigger a "MESSAGE_SUBMIT" event for a media message',
await processEvent(response);
});

Then('the header of the Conversation event "MESSAGE_SUBMIT" for a media message contains a valid signature', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Then('the header of the Conversation event {} for a media message contains a valid signature', (_event) => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Expand All @@ -293,7 +240,8 @@ When('I send a request to trigger a "MESSAGE_SUBMIT" event for a text message',
await processEvent(response);
});

Then('the header of the Conversation event "MESSAGE_SUBMIT" for a text message contains a valid signature', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Then('the header of the Conversation event {} for a text message contains a valid signature', (_event) => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Expand All @@ -310,11 +258,6 @@ When('I send a request to trigger a "SMART_CONVERSATIONS" event for a media mess
await processEvent(response);
});

// eslint-disable-next-line max-len
Then('the header of the Conversation event "SMART_CONVERSATIONS" for a media message contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "SMART_CONVERSATIONS" event type for a media message', () => {
const smartConversationsEvent = event as Conversation.SmartConversationsEvent;
assert.ok(smartConversationsEvent.smart_conversation_notification);
Expand All @@ -329,10 +272,6 @@ When('I send a request to trigger a "SMART_CONVERSATIONS" event for a text messa
await processEvent(response);
});

Then('the header of the Conversation event "SMART_CONVERSATIONS" for a text message contains a valid signature', () => {
assert.ok(conversationCallbackWebhook.validateAuthenticationHeader(formattedHeaders, rawEvent));
});

Then('the Conversation event describes a "SMART_CONVERSATIONS" event type for a text message', () => {
const smartConversationsEvent = event as Conversation.SmartConversationsEvent;
assert.ok(smartConversationsEvent.smart_conversation_notification);
Expand Down

0 comments on commit 369151c

Please sign in to comment.