Skip to content

Commit

Permalink
Merge pull request #26 from GSG-G8/23-testing
Browse files Browse the repository at this point in the history
23 testing
#23
  • Loading branch information
mFlaifel authored Feb 27, 2020
2 parents 0e6ba00 + ea5776c commit d3e1c78
Show file tree
Hide file tree
Showing 6 changed files with 958 additions and 695 deletions.
32 changes: 32 additions & 0 deletions __test__/test.js
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);
});
});
Loading

0 comments on commit d3e1c78

Please sign in to comment.