Skip to content

Commit 79a72fc

Browse files
committed
fix(js): Update tests
1 parent 3b64bd4 commit 79a72fc

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ test_ClientRequest
55
| apollo.js:17:1:17:34 | new Pre ... yurl"}) |
66
| apollo.js:20:1:20:77 | createN ... phql'}) |
77
| apollo.js:23:1:23:31 | new Web ... wsUri}) |
8-
| axios.ts:13:5:14:37 | api\\n ... repo}`) |
9-
| axios.ts:25:5:26:45 | api\\n ... , data) |
8+
| axios.ts:14:32:14:65 | api.get ... repo}`) |
9+
| axios.ts:25:32:25:73 | api.pat ... , data) |
1010
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) |
1111
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) |
1212
| puppeteer.ts:6:11:6:42 | page.go ... e.com') |
@@ -113,7 +113,7 @@ test_ClientRequest
113113
| tst.js:349:5:349:30 | axios.g ... url }) |
114114
| tst.js:352:5:352:66 | axiosIn ... text"}) |
115115
test_getADataNode
116-
| axios.ts:25:5:26:45 | api\\n ... , data) | axios.ts:26:41:26:44 | data |
116+
| axios.ts:25:32:25:73 | api.pat ... , data) | axios.ts:25:69:25:72 | data |
117117
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:15:18:15:55 | { 'Cont ... json' } |
118118
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:16:15:16:35 | {x: 'te ... 'test'} |
119119
| superagent.js:6:5:6:32 | superag ... st(url) | superagent.js:6:39:6:42 | data |
@@ -162,8 +162,8 @@ test_getADataNode
162162
| tst.js:347:5:347:30 | axios.p ... , data) | tst.js:347:26:347:29 | data |
163163
| tst.js:348:5:348:38 | axios.p ... config) | tst.js:348:26:348:29 | data |
164164
test_getHost
165-
| axios.ts:13:5:14:37 | api\\n ... repo}`) | axios.ts:4:14:4:37 | "https: ... ub.com" |
166-
| axios.ts:25:5:26:45 | api\\n ... , data) | axios.ts:4:14:4:37 | "https: ... ub.com" |
165+
| axios.ts:14:32:14:65 | api.get ... repo}`) | axios.ts:4:14:4:37 | "https: ... ub.com" |
166+
| axios.ts:25:32:25:73 | api.pat ... , data) | axios.ts:4:14:4:37 | "https: ... ub.com" |
167167
| tst.js:87:5:87:39 | http.ge ... host}) | tst.js:87:34:87:37 | host |
168168
| tst.js:89:5:89:23 | axios({host: host}) | tst.js:89:18:89:21 | host |
169169
| tst.js:91:5:91:34 | got(rel ... host}) | tst.js:91:29:91:32 | host |
@@ -178,8 +178,8 @@ test_getUrl
178178
| apollo.js:17:1:17:34 | new Pre ... yurl"}) | apollo.js:17:26:17:32 | "myurl" |
179179
| apollo.js:20:1:20:77 | createN ... phql'}) | apollo.js:20:30:20:75 | 'https: ... raphql' |
180180
| apollo.js:23:1:23:31 | new Web ... wsUri}) | apollo.js:23:25:23:29 | wsUri |
181-
| axios.ts:13:5:14:37 | api\\n ... repo}`) | axios.ts:14:12:14:36 | `/repos ... {repo}` |
182-
| axios.ts:25:5:26:45 | api\\n ... , data) | axios.ts:26:14:26:38 | `/repos ... {repo}` |
181+
| axios.ts:14:32:14:65 | api.get ... repo}`) | axios.ts:14:40:14:64 | `/repos ... {repo}` |
182+
| axios.ts:25:32:25:73 | api.pat ... , data) | axios.ts:25:42:25:66 | `/repos ... {repo}` |
183183
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:11:7:5 | {\\n ... ,\\n } |
184184
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:6:14:6:16 | url |
185185
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:11:17:5 | {\\n ... }\\n } |
@@ -296,8 +296,8 @@ test_getUrl
296296
| tst.js:352:5:352:66 | axiosIn ... text"}) | tst.js:352:19:352:65 | {method ... "text"} |
297297
| tst.js:352:5:352:66 | axiosIn ... text"}) | tst.js:352:40:352:42 | url |
298298
test_getAResponseDataNode
299-
| axios.ts:13:5:14:37 | api\\n ... repo}`) | axios.ts:13:5:14:37 | api\\n ... repo}`) | json | true |
300-
| axios.ts:25:5:26:45 | api\\n ... , data) | axios.ts:25:5:26:45 | api\\n ... , data) | json | true |
299+
| axios.ts:14:32:14:65 | api.get ... repo}`) | axios.ts:14:32:14:65 | api.get ... repo}`) | json | true |
300+
| axios.ts:25:32:25:73 | api.pat ... , data) | axios.ts:25:32:25:73 | api.pat ... , data) | json | true |
301301
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
302302
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
303303
| superagent.js:4:5:4:26 | superag ... ', url) | superagent.js:4:5:4:26 | superag ... ', url) | stream | true |

javascript/ql/test/library-tests/frameworks/ClientRequests/axios.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,23 @@ let api = axios.create({
1010
export default api;
1111

1212
export async function getRepo(owner: string, repo: string) {
13-
api
14-
.get(`/repos/${owner}/${repo}`)
15-
.then((response) => {
13+
try {
14+
const response = await api.get(`/repos/${owner}/${repo}`);
1615
console.log("Repository data:", response.data);
1716
return response.data;
18-
})
19-
.catch((error) => {
20-
console.error("Error fetching user:", error);
21-
});
17+
} catch (error) {
18+
console.error("Error fetching repo:", error);
19+
throw error;
20+
}
2221
}
2322

2423
export async function updateUser(owner: string, repo: string, data: any) {
25-
api
26-
.patch(`/repos/${owner}/${repo}`, data)
27-
.then((response) => {
24+
try {
25+
const response = await api.patch(`/repos/${owner}/${repo}`, data);
2826
console.log("User updated:", response.data);
29-
})
30-
.catch((error) => {
27+
return response.data;
28+
} catch (error) {
3129
console.error("Error updating user:", error);
32-
});
30+
throw error;
31+
}
3332
}

0 commit comments

Comments
 (0)