-
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.
Merge pull request #237 from SCCapstone/Testing-Brian
Testing
- Loading branch information
Showing
8 changed files
with
27,417 additions
and
12,995 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ npm-debug.* | |
*.mobileprovision | ||
*.orig.* | ||
web-build/ | ||
|
||
coverage/**/* | ||
# macOS | ||
.DS_Store |
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 @@ | ||
export default from '@react-native-async-storage/async-storage/jest/async-storage-mock'; |
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,16 @@ | ||
import * as React from 'react'; | ||
import FoodSearchScreen from '../../Screens/FoodSearchScreen'; | ||
import {render, screen, fireEvent,} from '@testing-library/react-native'; | ||
describe('FoodSearchScreenBehavioral', () => { | ||
const thisRoute = { params: 'breakfast' }; | ||
beforeEach(() => { | ||
var wrapper = render(<FoodSearchScreen route={thisRoute}/>); | ||
}); | ||
it('Renders results based on user input', async () => { | ||
const searchInput = screen.getByPlaceholderText('Search'); | ||
fireEvent.changeText(searchInput, 'ham'); | ||
fireEvent(searchInput, 'onEndEditing'); | ||
const results = screen.getAllByTestId('foodList'); | ||
expect(results).not.toBeNull(); | ||
}); | ||
}); |
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,17 @@ | ||
import * as React from 'react'; | ||
import FoodSearchScreen from '../../Screens/FoodSearchScreen'; | ||
import {render, screen, fireEvent,} from '@testing-library/react-native'; | ||
describe('FoodSearchScreen', () => { | ||
const thisRoute = { params: 'breakfast' }; | ||
beforeEach(() => { | ||
var wrapper = render(<FoodSearchScreen route={thisRoute}/>); | ||
}); | ||
it('ham search returns results', async () => { | ||
const searchInput = screen.getByPlaceholderText('Search'); | ||
fireEvent.changeText(searchInput, 'ham'); | ||
fireEvent(searchInput, 'onEndEditing'); | ||
const results = screen.getAllByTestId('foodList'); | ||
screen.debug(); | ||
expect(results).not.toBeNull(); | ||
}); | ||
}); |
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,61 @@ | ||
import { getNutrientValue } from '../../util' | ||
|
||
describe('Utility Functions ', () => { | ||
it('retrieve nutrient value from json ', async () => { | ||
let json = | ||
{ | ||
"foodNutrients":[ | ||
{ | ||
"nutrientId":1003, | ||
"nutrientName":"Protein", | ||
"nutrientNumber":"203", | ||
"unitName":"G", | ||
"derivationCode":"LCSL", | ||
"derivationDescription":"Calculated from a less than value per serving size measure", | ||
"derivationId":73, | ||
"value":2.56, | ||
"foodNutrientSourceId":9, | ||
"foodNutrientSourceCode":"12", | ||
"foodNutrientSourceDescription":"Manufacturer's analytical; partial documentation", | ||
"rank":600, | ||
"indentLevel":1, | ||
"foodNutrientId":24024317 | ||
}, | ||
{ | ||
"nutrientId":1004, | ||
"nutrientName":"Total lipid (fat)", | ||
"nutrientNumber":"204", | ||
"unitName":"G", | ||
"derivationCode":"LCCS", | ||
"derivationDescription":"Calculated from value per serving size measure", | ||
"derivationId":70, | ||
"value":15.4, | ||
"foodNutrientSourceId":9, | ||
"foodNutrientSourceCode":"12", | ||
"foodNutrientSourceDescription":"Manufacturer's analytical; partial documentation", | ||
"rank":800, | ||
"indentLevel":1, | ||
"foodNutrientId":24024318, | ||
"percentDailyValue":9 | ||
}, | ||
{ | ||
"nutrientId":1005, | ||
"nutrientName":"Carbohydrate, by difference", | ||
"nutrientNumber":"205", | ||
"unitName":"G", | ||
"derivationCode":"LCCS", | ||
"derivationDescription":"Calculated from value per serving size measure", | ||
"derivationId":70, | ||
"value":69.2, | ||
"foodNutrientSourceId":9, | ||
"foodNutrientSourceCode":"12", | ||
"foodNutrientSourceDescription":"Manufacturer's analytical; partial documentation", | ||
"rank":1110, | ||
"indentLevel":2, | ||
"foodNutrientId":24024319, | ||
"percentDailyValue":9 | ||
}]} | ||
result = getNutrientValue(json,"Carbohydrate, by difference") | ||
expect(result).toBe(69.2); | ||
}); | ||
}); |
Oops, something went wrong.