-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: CategoryEmptyResults component (#934)
- Loading branch information
1 parent
f18a19b
commit 97dbb13
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/theme/modules/catalog/category/components/__tests__/CategoryEmptyResults.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import CategoryEmptyResults from '../CategoryEmptyResults.vue'; | ||
import { render } from '~/test-utils'; | ||
import { expect } from '@jest/globals'; | ||
|
||
describe('CategoryEmptyResults.vue', () => { | ||
it('Renders with a default value', () => { | ||
const { getByRole, queryByText } = render(CategoryEmptyResults); | ||
|
||
const svgImage = getByRole('img'); | ||
const paragraph = queryByText(`We can't find products matching the selection.`); | ||
|
||
expect(svgImage).toBeDefined(); | ||
expect(paragraph).toBeDefined(); | ||
}); | ||
|
||
it('Renders content from the "default" slot', () => { | ||
const wrapper = render(CategoryEmptyResults, { | ||
slots: { | ||
default: `<div id="testSlot"></div>` | ||
} | ||
}); | ||
expect(wrapper.html()).toContain('<div id="testSlot"></div>'); | ||
}); | ||
}); |