Skip to content

Commit

Permalink
switch to 'let wrapper' and 'beforeEach()'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellamaki committed Jan 28, 2022
1 parent 70a90de commit a0038fd
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ import { shallowMount } from '@vue/test-utils';
import LibraryAndChannelBrowserMainContent from '../../src/views/LibraryAndChannelBrowserMainContent';

describe('Library and Channel Browser Main Content', () => {
const wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsLarge: () => true, backRoute: 'test' },
propsData: { contents: [{ node: 1 }], currentCardViewStyle: 'card' },
let wrapper;
beforeEach(() => {
wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsSmall: () => false, backRoute: 'test' },
propsData: { contents: [{ node: 1 }], currentCardViewStyle: 'card' },
});
});

it('smoke test', () => {
expect(wrapper.exists()).toBe(true);
});
describe('When the user has a medium or large screen', () => {
describe('When `currentCardViewStyle` is a card', () => {
const wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsSmall: () => false, backRoute: 'test' },
propsData: { contents: [{ node: 1 }], currentCardViewStyle: 'card' },
});
it('displays a `CardGrid`, and within the grid, a `HybridLearningContentCard` for each content node', () => {
expect(wrapper.find('[data-test="non-mobile-card-grid"]').element).toBeTruthy();
expect(wrapper.find('[data-test="content-card"]').element).toBeTruthy();
Expand All @@ -29,9 +27,11 @@ describe('Library and Channel Browser Main Content', () => {
});
});
describe('When `currentCardViewStyle` is a list', () => {
const wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsSmall: () => false, backRoute: 'test' },
propsData: { contents: [{ node: 1 }], currentCardViewStyle: 'list' },
beforeEach(() => {
wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsSmall: () => false, backRoute: 'test' },
propsData: { contents: [{ node: 1 }], currentCardViewStyle: 'list' },
});
});
it('displays a `HybridLearningContentCardListView` for each content node, in a single, full-width column', () => {
expect(wrapper.find('[data-test="card-list-view"]').element).toBeTruthy();
Expand All @@ -47,9 +47,11 @@ describe('Library and Channel Browser Main Content', () => {
});
});
describe('When the user is on a mobile device', () => {
const wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsSmall: () => true, backRoute: 'test' },
propsData: { contents: [{ node: 1 }] },
beforeEach(() => {
wrapper = shallowMount(LibraryAndChannelBrowserMainContent, {
computed: { windowIsSmall: () => true, backRoute: 'test' },
propsData: { contents: [{ node: 1 }] },
});
});
it('displays a `CardGrid` with a `ResourceCard` for each content node in a single, full-width column', () => {
expect(wrapper.find('[data-test="mobile-card-grid"]').element).toBeTruthy();
Expand Down

0 comments on commit a0038fd

Please sign in to comment.