forked from RyanNoelk/OpenEats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding some jest tests * fixing tests and the code * Prevent filters from breaking when the page is small * updating readme and lock file * playing around with tests * updating tests * adding jest test for ratings and mocks * adding more rating tests * removing data file and making the data simpler * adding test for recipe * using data file for testing * updating test names * semi-colons
- Loading branch information
Showing
17 changed files
with
1,119 additions
and
38 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
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
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
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
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,3 @@ | ||
// __mocks__/fileMock.js | ||
|
||
module.exports = 'test-file-stub'; |
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,3 @@ | ||
// __mocks__/styleMock.js | ||
|
||
module.exports = {}; |
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
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
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,13 @@ | ||
import React from 'react'; | ||
import Directions from '../components/Directions'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import data from './data'; | ||
|
||
test('Direction component test', () => { | ||
const component = renderer.create( | ||
<Directions data={ data.directions }/> | ||
); | ||
let tree = component.toJSON(); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import Ingredients from '../components/Ingredients'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import data from './data'; | ||
|
||
test('Ingredient component test', () => { | ||
const component = renderer.create( | ||
<Ingredients data={ data.ingredients }/> | ||
); | ||
let tree = component.toJSON(); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import Ratings from '../components/Ratings'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
test('2 Star Rating test', () => { | ||
const component = renderer.create( | ||
<Ratings stars={ 2 }/> | ||
); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('0 Star Rating test', () => { | ||
const component = renderer.create( | ||
<Ratings stars={ -3 }/> | ||
); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('4 Star Rating test', () => { | ||
const component = renderer.create( | ||
<Ratings stars={ 4 }/> | ||
); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('5 Star Rating test', () => { | ||
const component = renderer.create( | ||
<Ratings stars={ 24 }/> | ||
); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); |
48 changes: 48 additions & 0 deletions
48
frontend/modules/recipe/tests/__snapshots__/Directions.test.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,48 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Direction component test 1`] = ` | ||
<ol | ||
className="directions" | ||
> | ||
<li | ||
className="direction" | ||
> | ||
Brown the ground pork and ground sirlion in a medium pan. Add a teaspoon of sereano pepper while browning the meat. Season with kosher salt and pepper. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Chop the onion, bell pepper and one Serrano pepper and place them in a large pot. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Open up and drain both cans of kidney beans and add them to the large pot. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Open up both cans of stewed chili style tomatoes and add them to the pot. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Drain the grease away from the browned meat and add the meat to the pot. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Pour in the tomato juice over the meat mixture. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Add kosher salt, black pepper, two table spoons of chili powder, and two teaspoons of ground cumin. Stir well. | ||
</li> | ||
<li | ||
className="direction" | ||
> | ||
Cook slowly over medium low heat for an hour. If it starts to bubble turn down the heat. Taste during the cooking process to check the seasoning add more to taste. | ||
</li> | ||
</ol> | ||
`; |
116 changes: 116 additions & 0 deletions
116
frontend/modules/recipe/tests/__snapshots__/Ingredients.test.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,116 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Ingredient component test 1`] = ` | ||
<ul | ||
className="ingredients" | ||
> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
dash | ||
black pepper | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
4 | ||
tablespoons | ||
chili powder | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
tablespoon | ||
cumin | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
can | ||
dark kidney beans | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
2 | ||
cans | ||
diced tomatos | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
whole | ||
green bell pepper | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
pound | ||
ground pork | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
pound | ||
ground sirloin | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
dash | ||
kosher salt | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
can | ||
light kidney beans | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
whole | ||
serrano pepper | ||
</li> | ||
<li | ||
className="ingredient" | ||
> | ||
1 | ||
whole | ||
white onion | ||
</li> | ||
</ul> | ||
`; |
Oops, something went wrong.