File tree Expand file tree Collapse file tree 4 files changed +1
-49
lines changed
Filter options
Expand file tree Collapse file tree 4 files changed +1
-49
lines changed
Original file line number Diff line number Diff line change 3
3
* .log
4
4
node_modules
5
5
package-lock.json
6
- * operations / tempCodeRunnerFile.js
6
+ * tempCodeRunnerFile.js
7
7
8
8
#
9
9
# Optional npm cache directory
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
//Takes a username as an argument and makes a call to GitHub API
2
2
//and returns all the repositoriesowned by the user as an array.
3
- const { getCustomer } = require ( "./db" ) ;
4
-
5
- module . exports . applyDiscount = function ( order ) {
6
- const customer = getCustomer ( order . customerId ) ;
7
-
8
- customer . points > 10 ? ( order . totalPrice *= 0.9 ) : false ;
9
- } ;
Original file line number Diff line number Diff line change 1
- const getRepo = require ( "./getRepo" ) ;
2
- const db = require ( "./db" ) ;
3
1
4
- let showGitHubUser = require ( "./getRepo" ) ;
5
-
6
- // describe("Testing Mock....", () => {
7
- // it("Should apply discount to total", () => {
8
- // db.getCustomer = function(customerId) {
9
- // console.log("Getting data from fake database");
10
- // return { id: customerId, points: 20 };
11
- // };
12
-
13
- // const order = { customerId: 1, totalPrice: 10 };
14
- // getRepo.applyDiscount(order);
15
-
16
- // expect(order.totalPrice).toBe(9);
17
- // });
18
- // });
19
-
20
- // describe("Mock testing getRepo implementation", () => {
21
- // it("Make sure fetchRepo function is callled", () => {
22
- // const handle = "iKnowJavaScript";
23
- // showGitHubUser = jest
24
- // .fn(handle)
25
- // .mockResolvedValue([
26
- // "Ball-Bouncing-and-Collision",
27
- // "css-grid",
28
- // "CSS-Grid-Calculator",
29
- // "CSS-Grid-Phone",
30
- // "css-protips",
31
- // "Databaseless-API"
32
- // ]);
33
-
34
- // expect(showGitHubUser).toHaveBeenCalledWith(handle);
35
- // });
36
- // it("Should make sure an array of repo was return", () => {});
37
- // it("Should return 'User has not repository yet' if it return an empty array", () => {});
38
- // it("Should return 'User not found' if no array was returned", () => {});
39
- // });
You can’t perform that action at this time.
0 commit comments