Commit 85a71098 authored by Kev's avatar Kev

Add null date check to whats new feature spec

parent e216f4c2
...@@ -19,7 +19,7 @@ describe("What's new single feature", () => { ...@@ -19,7 +19,7 @@ describe("What's new single feature", () => {
release: '13.11', release: '13.11',
}; };
const findReleaseDate = () => wrapper.find('[data-testid="release-date"]').text(); const findReleaseDate = () => wrapper.find('[data-testid="release-date"]');
const createWrapper = ({ feature } = {}) => { const createWrapper = ({ feature } = {}) => {
wrapper = shallowMount(Feature, { wrapper = shallowMount(Feature, {
...@@ -34,6 +34,13 @@ describe("What's new single feature", () => { ...@@ -34,6 +34,13 @@ describe("What's new single feature", () => {
it('renders the date', () => { it('renders the date', () => {
createWrapper({ feature: exampleFeature }); createWrapper({ feature: exampleFeature });
expect(findReleaseDate()).toBe('April 22, 2021'); expect(findReleaseDate().text()).toBe('April 22, 2021');
});
describe('when the published_at is null', () => {
it("doesn't render the date", () => {
createWrapper({ feature: { ...exampleFeature, published_at: null } });
expect(findReleaseDate().exists()).toBe(false);
});
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment