-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_indexTest.js
149 lines (95 loc) · 2.1 KB
/
script_indexTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
* Projektaufgabe, Abgabeterim: 21.09.2020, Geosoft 1, SoSe 2020
* @author {Timo Lietmeyer} matr.Nr.: {459169}
* @author {Judith Bresser} matr.Nr.: {459956}
*/
//**various jshint configs**
// jshint esversion: 8
// jshint browser: true
// jshint node: true
// jshint -W117
// jshint -W083
"use strict";
/**
*@desc QUnit test for API
*
*/
QUnit.test("Check API Request",async function (assert) {
var res = await connectAPI()
console.log(res);
if (res == 200){assert.ok(true)}else{assert.ok(false)}
}
);
/**
*@desc QUnit test for check logged User Function
*
*/
QUnit.test("check logged User",
async function (assert) {
var temp = await test_get_logged_User()
console.log(temp);
if (temp == 200){assert.ok(true)}else{assert.ok(false)}
},
);
/**
*@desc QUnit test for get all User Data Function
*
*/
QUnit.test("get all User Function",
async function (assert) {
var temp = await test_get_User()
console.log(temp);
if (temp == 200){assert.ok(true)}else{assert.ok(false)}
},
);
/**
*@desc temp function for test.html
*
*/
async function connectAPI(){
var t ;
await $.ajax({
url: "https://transit.hereapi.com/v8/departures?in=" + [50.0000,48.000] + ";r=500",
method: "GET",
data: {
apiKey: HERE_API_KEY
},
}).done( function(rs, textStatus, xhr) {
console.log(xhr.getResponseHeader('X-CUSTOM-HEADER'));
console.log(xhr.status);
t = xhr.status
});
return t;
}
/**
*@desc temp function for test.html
*
*/
async function test_get_logged_User(){
var t ;
await $.ajax({
url: "/logged_User",
method: "GET",
}).done( function(rs, textStatus, xhr) {
console.log(xhr.getResponseHeader('X-CUSTOM-HEADER'));
console.log(xhr.status);
t = xhr.status
});
return t;
}
/**
*@desc temp function for test.html
*
*/
async function test_get_User(){
var t ;
await $.ajax({
url: "/User",
method: "GET",
}).done( function(rs, textStatus, xhr) {
console.log(xhr.getResponseHeader('X-CUSTOM-HEADER'));
console.log(xhr.status);
t = xhr.status
});
return t;
}