This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
idmontie-gravatar-tests.js
70 lines (51 loc) · 2.11 KB
/
idmontie-gravatar-tests.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
/* global Gravatar */
Tinytest.add('example', function ( test ) {
'use strict';
test.equal( true, true );
});
Tinytest.add( 'hash should return a hash of the trimmed, lower case version of the email', function ( test ) {
'use strict';
var hash0 = Gravatar.hash( '[email protected]' )
test.equal( hash0, '0bc83cb571cd1c50ba6f3e8a78ef1346' )
var hash1 = Gravatar.hash( '[email protected] ' )
test.equal( hash1, '0bc83cb571cd1c50ba6f3e8a78ef1346' )
var hash2 = Gravatar.hash( '[email protected]' )
test.equal( hash2, '0bc83cb571cd1c50ba6f3e8a78ef1346' )
var hash3 = Gravatar.hash( '[email protected]' )
test.equal( hash3, 'de2fe4e58ee0f9fc1c1c1a71feeab8f8' )
});
Tinytest.add( 'imageUrl without options should return url', function ( test ) {
'use strict';
var url = Gravatar.imageUrl()
test.equal( url, 'http://www.gravatar.com/avatar/')
});
Tinytest.add( 'imageUrlFromEmail with email should return url', function ( test ) {
'use strict';
var url = Gravatar.imageUrlFromEmail( '[email protected]' )
test.equal( url, 'http://www.gravatar.com/avatar/de2fe4e58ee0f9fc1c1c1a71feeab8f8' )
} )
Tinytest.add( 'imageUrl with options should return url', function ( test ) {
'use strict';
var url = Gravatar.imageUrl( {
hash : 'de2fe4e58ee0f9fc1c1c1a71feeab8f8',
size : 32,
gDefault : Gravatar.DEFAULTS['404'],
forceDefault : false,
rating : Gravatar.RATINGS.g,
secure : true
} )
test.equal( url, 'https://secure.gravatar.com/avatar/de2fe4e58ee0f9fc1c1c1a71feeab8f8?s=32&d=404&r=g' )
} )
Tinytest.add( 'profileUrlFromEmail with email should return url', function ( test ) {
'use strict';
var url = Gravatar.profileUrlFromEmail( '[email protected]' )
test.equal( url, 'https://secure.gravatar.com/avatar/de2fe4e58ee0f9fc1c1c1a71feeab8f8' )
} )
Tinytest.add( 'profileUrl with optoins should return url', function ( test ) {
'use strict';
var url = Gravatar.profileUrl( {
hash : 'de2fe4e58ee0f9fc1c1c1a71feeab8f8',
callback: 'alert'
} )
test.equal( url, 'https://secure.gravatar.com/avatar/de2fe4e58ee0f9fc1c1c1a71feeab8f8?callback=alert' )
} )