Skip to content

Commit

Permalink
fix: updated tests to match new functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
omarbassam88 committed Oct 21, 2024
1 parent 2e73f87 commit a4f0314
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions components/x-gift-article/__tests__/x-gift-article.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const baseArgs = {
'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolorum quos, quis quas ad, minima fuga at nemo deleniti hic repellendus totam. Impedit mollitia quam repellat harum. Nostrum sapiente minima soluta , Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolorum quos, quis quas ad, minima fuga at nemo deleniti hic repellendus totam. Impedit mollitia quam repellat harum. Nostrum sapiente minima soluta.'
}

const trimmedHighlight = baseArgs.highlight.split(' ').slice(0, 30).join(' ')
const expectedHighlightText = `${baseArgs.article.title} - "${trimmedHighlight} ..."`

describe('x-gift-article', () => {
let actions = {}

Expand Down Expand Up @@ -85,8 +88,8 @@ describe('x-gift-article', () => {

subject.update()

const input = subject.find('input#share-link')
expect(input.prop('value')).toEqual('https://shortened-non-gift-url')
const input = subject.find('#share-link')
expect(input.prop('value')).toEqual(expectedHighlightText + '\n\n' + 'https://shortened-non-gift-url')
})

it('should call createGiftUrl and display correct url', async () => {
Expand All @@ -96,9 +99,9 @@ describe('x-gift-article', () => {

subject.update()

const input = subject.find('input#share-link')
const input = subject.find('#share-link')

expect(input.prop('value')).toEqual('https://shortened-gift-url')
expect(input.prop('value')).toEqual(expectedHighlightText + '\n\n' + 'https://shortened-gift-url')
})

it('should call createEnterpriseUrl and display correct url', async () => {
Expand All @@ -108,8 +111,8 @@ describe('x-gift-article', () => {

subject.update()

const input = subject.find('input#share-link')
expect(input.prop('value')).toEqual('https://gift-url-redeemed')
const input = subject.find('#share-link')
expect(input.prop('value')).toEqual(expectedHighlightText + '\n\n' + 'https://gift-url-redeemed')
})

it('when credits are available, an alert is not shown', async () => {
Expand Down

0 comments on commit a4f0314

Please sign in to comment.