Skip to content

Commit 1fab845

Browse files
committed
Make unit tests a bit more "testy".
1 parent 92efa4b commit 1fab845

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/unit.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,15 @@ if ( $.Deferred ) {
8888

8989
test( "promise - success", function() {
9090
stop();
91-
expect( 1 );
91+
expect( 2 );
9292
$.jsonp({
9393
url: "http://gdata.youtube.com/feeds/api/users/julianaubourg?callback=?",
9494
data: {
9595
alt: "json-in-script"
9696
},
97+
success: function() {
98+
ok( true, "Success (options)" );
99+
},
97100
complete: function() {
98101
start();
99102
}
@@ -106,12 +109,15 @@ if ( $.Deferred ) {
106109

107110
test( "promise - error (HTTP Code)", function() {
108111
stop();
109-
expect( 1 );
112+
expect( 2 );
110113
$.jsonp({
111114
url: "http://gdata.youtube.com/feeds/api/users/hgfusyggbvbdbrfvurgbirhtiytjrhjsrhk66?callback=?",
112115
data: {
113116
alt: "json-in-script"
114117
},
118+
error: function() {
119+
ok( true, "Error (options)" );
120+
},
115121
complete: function() {
116122
start();
117123
}
@@ -124,7 +130,7 @@ if ( $.Deferred ) {
124130

125131
test( "promise - error (Syntax Error)", function() {
126132
stop();
127-
expect( 2 );
133+
expect( 3 );
128134
var oldOnError = window.onerror;
129135
window.onerror = function() {
130136
ok( true, "Syntax Error Thrown" );
@@ -133,6 +139,9 @@ if ( $.Deferred ) {
133139
$.jsonp({
134140
url: "data/syntax-error.js",
135141
cache: true,
142+
error: function() {
143+
ok( true, "Error (options)" );
144+
},
136145
complete: function() {
137146
window.onerror = oldOnError;
138147
start();
@@ -146,10 +155,13 @@ if ( $.Deferred ) {
146155

147156
test( "promise - error (callback not called)", function() {
148157
stop();
149-
expect( 2 );
158+
expect( 3 );
150159
$.jsonp({
151160
url: "data/no-callback.js",
152161
cache: true,
162+
error: function() {
163+
ok( true, "Error (options)" );
164+
},
153165
complete: function() {
154166
strictEqual( window.bob, 33, "script was executed" );
155167
window.bob = false;

0 commit comments

Comments
 (0)