-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy pathbonus-product-quantity.test.jsx
More file actions
32 lines (28 loc) · 1.12 KB
/
bonus-product-quantity.test.jsx
File metadata and controls
32 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Copyright (c) 2025, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import React from 'react'
import {render, screen} from '@testing-library/react'
import {IntlProvider} from 'react-intl'
import BonusProductQuantity from '@salesforce/retail-react-app/app/components/product-item/bonus-product-quantity'
const mockProduct = {quantity: 1}
const renderWithIntl = (component) =>
render(
<IntlProvider locale="en" defaultLocale="en">
{component}
</IntlProvider>
)
describe('BonusProductQuantity', () => {
test('renders the quantity text', () => {
renderWithIntl(<BonusProductQuantity product={mockProduct} />)
expect(screen.getByText(/Quantity: 1/)).toBeInTheDocument()
})
test('applies correct aria-label', () => {
renderWithIntl(<BonusProductQuantity product={mockProduct} />)
const quantityElement = screen.getByText(/Quantity: 1/)
expect(quantityElement).toHaveAttribute('aria-label')
})
})