-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
102 lines (95 loc) · 2.14 KB
/
index.test.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
const axios = require("axios");
function user_login_test() {
axios
.post("https://us-central1-handown.cloudfunctions.net/users/login", {
"email" : "[email protected]",
"password" : "1235"
})
.then((res) => {
if(res.status=="200"){
console.log("Test is successfull")
console.log(res.data)
}
});
}
function user_wrong_login_test() {
axios
.post("https://us-central1-handown.cloudfunctions.net/users/login", {
"email" : "[email protected]",
"password" : "15"
})
.then((res) => {
if(res.status=="200"){
console.log("Test is not successfull")
console.log()
}
else{
console.log("Test is successfull")
console.log()
}
})
.catch(error => {
console.log("User cannot login \nTest is successfull")
});
}
function singup_test_with_one_character_password() {
axios
.post("https://us-central1-handown.cloudfunctions.net/users/signup", {
"email" : "[email protected]",
"name" : "volkan",
"surname" : "sahin",
"password" : "s",
"type" : "SELLER"
})
.then((res) => {
if(res.status=="200"){
console.log("Test is not successfull")
console.log()
}
else{
console.log("Test is successfull")
console.log()
}
})
.catch(error => {
console.log("User cannot signup \nTest is successfull")
});
}
function singup_test_with_valid_password() {
axios
.post("https://us-central1-handown.cloudfunctions.net/users/signup", {
"email" : "[email protected]",
"name" : "volkan",
"surname" : "sahin",
"password" : "volkan",
"type" : "SELLER"
})
.then((res) => {
if(res.status=="200"){
console.log("Test is successfull")
console.log()
}
else{
console.log("Test is not successfull")
console.log()
}
})
.catch(error => {
console.log("User cannot signup \nTest is unsuccessfull")
console.log(error.data)
});
}
function get_users_test() {
axios
.get("https://us-central1-handown.cloudfunctions.net/users")
.then((res) => {
if(res.status=="200"){
console.log("Test is successfull")
}
});
}
user_login_test()
user_wrong_login_test()
singup_test_with_one_character_password()
singup_test_with_valid_password()
get_users_test()