Skip to content

Commit

Permalink
combine test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-tvu committed Feb 15, 2024
1 parent 5980657 commit c67fc45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 43 deletions.
32 changes: 2 additions & 30 deletions web/src/app/storybook/defaultDestTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export const destTypes: DestinationTypeInfo[] = [
fieldID: 'third-field',
labelSingular: 'Third Item',
labelPlural: 'Third Items',
hint: '',
hintURL: '',
hint: 'docs',
hintURL: '/docs',
placeholderText: 'slack user ID',
prefix: '',
inputType: 'string',
Expand Down Expand Up @@ -165,32 +165,4 @@ export const destTypes: DestinationTypeInfo[] = [
},
],
},
{
type: 'webhook-field',
name: 'Webhook Field Destination Type',
enabled: true,
disabledMessage: 'Webhook field destination type must be configured.',
userDisclaimer: '',
isContactMethod: true,
isEPTarget: false,
isSchedOnCallNotify: false,
iconURL: '',
iconAltText: '',
supportsStatusUpdates: true,
statusUpdatesRequired: false,
requiredFields: [
{
fieldID: 'webhook-url',
labelSingular: 'Webhook Url',
labelPlural: '',
hint: 'Webhook Documentation',
hintURL: '/docs#webhooks',
placeholderText: 'https://target.com',
prefix: '',
inputType: 'url',
isSearchSelectable: false,
supportsValidation: false,
},
],
},
]
24 changes: 11 additions & 13 deletions web/src/app/users/UserContactMethodListDest.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ const meta = {
},
{
id: '1111',
name: 'my_webhook',
name: 'single field CM',
dest: {
type: 'webhook-field',
type: 'single-field',
values: [
{
fieldID: 'webhook-url',
value: 'https://target.com',
label: 'https://target.com',
fieldID: 'phone-number',
value: '+15555555556',
label: '+1 555-555-5556',
},
],
},
Expand Down Expand Up @@ -145,22 +145,20 @@ export const MultiContactMethods: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement)

// ensure correct info is displayed for webhook CM
// ensure correct info is displayed for first CM
await expect(
await canvas.findByText('my_webhook (Webhook Url)'),
await canvas.findByText('single field CM (Phone Number)'),
).toBeVisible()
await expect(canvas.getByText('Webhook Documentation')).toHaveAttribute(
'href',
'/docs#webhooks',
)

// ensure correct info is displayed for triple-field CM
await expect(
await canvas.findByText('triple contact method (First Item)'),
).toBeVisible()
await expect(await canvas.findByText('+1 555-555-5555')).toBeVisible()
await expect(await canvas.findByText('+1 555-555-5556')).toBeVisible()
await expect(await canvas.findByText('test_user@target.com')).toBeVisible()
await expect(await canvas.findByText('@TestUser')).toBeVisible()

// ensure has link when hint url exists
await expect(canvas.getByText('docs')).toHaveAttribute('href', '/docs')

// ensure all edit icons exists
await expect(await canvas.findAllByTestId('MoreHorizIcon')).toHaveLength(2)
Expand Down

0 comments on commit c67fc45

Please sign in to comment.