-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Product Out of Stock Message (#1229)
* Fixed #1159 Fixed #1159 [bug]: If user tries to access product page after it goes to out of stock then system enters a infinite loop. * Updates Product to show out of stock message when appropriate * Adds Unit Tests to ErrorView
- Loading branch information
1 parent
d2b5a8a
commit 5544164
Showing
4 changed files
with
72 additions
and
2 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
29 changes: 29 additions & 0 deletions
29
...ges/venia-concept/src/components/ErrorView/__tests__/__snapshots__/errorView.spec.js.snap
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,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`it renders the correct tree when loading 1`] = ` | ||
<h1> | ||
<Classify(LoadingIndicator)> | ||
<span> | ||
Fetching Data... | ||
</span> | ||
</Classify(LoadingIndicator)> | ||
</h1> | ||
`; | ||
|
||
exports[`it renders the correct tree when out of stock 1`] = ` | ||
<h1> | ||
This Product is currently out of stock. Please try again later. | ||
</h1> | ||
`; | ||
|
||
exports[`it renders the correct tree when page not found 1`] = ` | ||
<h1> | ||
That page could not be found. Please try again. | ||
</h1> | ||
`; | ||
|
||
exports[`it renders the internal error tree otherwise 1`] = ` | ||
<h1> | ||
Something went wrong. Please try again. | ||
</h1> | ||
`; |
30 changes: 30 additions & 0 deletions
30
packages/venia-concept/src/components/ErrorView/__tests__/errorView.spec.js
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,30 @@ | ||
import React from 'react'; | ||
import ShallowRenderer from 'react-test-renderer/shallow'; | ||
|
||
import ErrorView from '../errorView'; | ||
|
||
const renderer = new ShallowRenderer(); | ||
|
||
test('it renders the correct tree when loading', () => { | ||
const tree = renderer.render(<ErrorView loading={true} />); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('it renders the correct tree when page not found', () => { | ||
const tree = renderer.render(<ErrorView notFound={true} />); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('it renders the correct tree when out of stock', () => { | ||
const tree = renderer.render(<ErrorView outOfStock={true} />); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('it renders the internal error tree otherwise', () => { | ||
const tree = renderer.render(<ErrorView />); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); |
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
5544164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully aliased the URL https://venia-hzvfccim0.now.sh to the following aliases.