forked from guillaumeguerin/mysnapchat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.html
64 lines (57 loc) · 2.01 KB
/
tests.html
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
<html>
<head>
<meta charset="utf-8">
<title>QUnit SnapChatBordeaux</title>
<link rel="stylesheet" href="css/qunit-1.14.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="js/qunit-1.14.0.js"></script>
<script src="js/md5.js"></script>
<script src="js/cookies.js"></script>
<script src="js/xmlhttprequest.js"></script>
<script src="js/register.js"></script>
<script src="js/friends.js"></script>
</body>
<script>
test("md5 test", function () {
equal(CryptoJS.MD5("123456"), "e10adc3949ba59abbe56e057f20f883e");
});
test("Cookie test", function () {
setCookie("email", "guerin_guillaume@hotmail.fr", 30);
setCookie("password", "123456", 30);
equal(getCookie("email"), "guerin_guillaume@hotmail.fr");
flogout();
equal(getCookie("email"), "");
});
test("Register test", function () {
var email = "guerin_guillaume@hotmail.fr";
var password = "A1b2c3aa";
var confirmpassword = "A1b2c3aa";
var name = "Guillaume";
var description = "Etudiant";
/* Email */
ok(checkEmail(email));
ok(!checkEmail("toto"));
ok(!checkEmail("toto.fr"));
ok(!checkEmail("toto@"));
ok(!checkEmail("toto@toto"));
ok(!checkEmail("@toto.fr"));
/* Password */
ok(checkPassword(password));
ok(!checkPassword("aa"));
ok(!checkPassword("0123456789abcdefghijklmnopqrstuvwxyz"));
ok(!checkPassword("AAAAAAAA5"));
ok(checkPasswordConfirm(password, confirmpassword));
ok(!checkPasswordConfirm(password, ""));
/* Name */
ok(checkName(name));
ok(!checkName("b"));
ok(!checkName("0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz"));
/* Description */
ok(checkDescription(description));
ok(!checkDescription("0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz"));
});
</script>
</html>