-
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 #26 from GSG-G8/23-testing
23 testing #23
- Loading branch information
Showing
6 changed files
with
958 additions
and
695 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const connection = require('../server/database/config/connection'); | ||
|
||
const buildDB = require('../server/database/config/bulit'); | ||
|
||
const { getdata } = require('../server/database/queries/getdata'); | ||
|
||
// test('jest is working', () => { | ||
// expect(1).toBe(1); | ||
// }); | ||
|
||
beforeAll(() => { | ||
return buildDB(); | ||
}); | ||
|
||
afterAll(() => { | ||
return connection.end(); | ||
}); | ||
|
||
|
||
test('test getdata query', () => { | ||
return getdata().then((data) => { | ||
const actual = data.rows[0]; | ||
const expected = { | ||
id: 1, | ||
name: 'Quick banana ice cream', | ||
ingredients: '4 ripe bananas, cut into chunks,3-4 tbsp milk, 2 tbsp toasted flaked almonds, 2 tbsp ready-made toffee or chocolate sauce', | ||
preparation: 'Pop the banana chunks on a flat tray and cover well. Freeze for at least 1 hr, or until frozen through. When ready to eat throw the banana into a food processor and whizz until smooth with enough of the milk to achieve a creamy texture. Scoop into 4 bowls or glasses, then top with the sauce and nuts.', | ||
imgurl: 'https://www.bbcgoodfood.com/sites/default/files/recipe_images/recipe-image-legacy-id--653634_11.jpg' | ||
}; | ||
expect(actual).toEqual(expected); | ||
}); | ||
}); |
Oops, something went wrong.