File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ var fakeServer = {
100
100
this . xhr = fakeXhr . useFakeXMLHttpRequest ( ) ;
101
101
server . requests = [ ] ;
102
102
server . requestCount = 0 ;
103
+ server . queue = [ ] ;
104
+ server . responses = [ ] ;
105
+
103
106
104
107
this . xhr . onCreate = function ( xhrObj ) {
105
108
xhrObj . unsafeHeadersEnabled = function ( ) {
@@ -166,10 +169,6 @@ var fakeServer = {
166
169
167
170
handleRequest : function handleRequest ( xhr ) {
168
171
if ( xhr . async ) {
169
- if ( ! this . queue ) {
170
- this . queue = [ ] ;
171
- }
172
-
173
172
push . call ( this . queue , xhr ) ;
174
173
} else {
175
174
this . processRequest ( xhr ) ;
@@ -199,10 +198,6 @@ var fakeServer = {
199
198
return ;
200
199
}
201
200
202
- if ( ! this . responses ) {
203
- this . responses = [ ] ;
204
- }
205
-
206
201
if ( arguments . length === 1 ) {
207
202
body = method ;
208
203
url = method = null ;
Original file line number Diff line number Diff line change @@ -56,6 +56,22 @@ describe("sinonSandbox", function () {
56
56
assert . same ( sandbox . assert , sinonAssert ) ;
57
57
} ) ;
58
58
59
+ it ( "can be reset without failing when pre-configured to use a fake server" , function ( ) {
60
+ var sandbox = sinonSandbox . create ( { useFakeServer : true } ) ;
61
+ refute . exception ( function ( ) {
62
+ sandbox . reset ( ) ;
63
+ } ) ;
64
+ } ) ;
65
+
66
+ it ( "can be reset without failing when configured to use a fake server" , function ( ) {
67
+ var sandbox = sinonSandbox . create ( ) ;
68
+ sandbox . useFakeServer ( ) ;
69
+ refute . exception ( function ( ) {
70
+ sandbox . reset ( ) ;
71
+ } ) ;
72
+ } ) ;
73
+
74
+
59
75
describe ( ".useFakeTimers" , function ( ) {
60
76
beforeEach ( function ( ) {
61
77
this . sandbox = Object . create ( sinonSandbox ) ;
You can’t perform that action at this time.
0 commit comments