Skip to content

Commit

Permalink
test: CategoryEmptyResults component (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
Diegoalbag authored Apr 29, 2022
1 parent f18a19b commit 97dbb13
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/theme/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { config } from '@vue/test-utils';
config.stubs = {
NuxtImg: { render(h) { return h('img'); } },
};
config.mocks = {
$t: (text) => text
}

const $vsf = {
$magento: {
Expand Down
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>');
});
});

0 comments on commit 97dbb13

Please sign in to comment.