sinon: move incorrect xhr restore method (#26119)

This commit is contained in:
James Garbutt
2018-05-29 15:55:03 -07:00
committed by Mohamed Hegazy
parent 4757d2b37c
commit 38df6613ce
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -271,7 +271,6 @@ declare namespace Sinon {
getAllResponseHeaders(): any;
// Methods
restore(): void;
setResponseHeaders(headers: any): void;
setResponseBody(body: string): void;
respond(status: number, headers: any, body: string): void;
@@ -285,6 +284,7 @@ declare namespace Sinon {
useFilters: boolean;
addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void;
onCreate(xhr: SinonFakeXMLHttpRequest): void;
restore(): void;
}
interface SinonFakeServer extends SinonFakeServerOptions {
+2 -1
View File
@@ -40,6 +40,7 @@ function testSandbox() {
const xhr = sb.useFakeXMLHttpRequest();
xhr.useFilters = true;
xhr.restore();
const server = sb.useFakeServer();
server.respondWith('foo');
@@ -98,7 +99,6 @@ function testXHR() {
const headers = xhr.getAllResponseHeaders();
const header = xhr.getResponseHeader('foo');
xhr.restore();
xhr.setResponseHeaders({ 'Content-Type': 'text/html' });
xhr.setResponseBody('foo');
xhr.respond(200, { 'Content-Type': 'foo' }, 'bar');
@@ -107,6 +107,7 @@ function testXHR() {
sinon.FakeXMLHttpRequest.useFilters = true;
sinon.FakeXMLHttpRequest.addFilter((method, url, async, user, pass) => true);
sinon.FakeXMLHttpRequest.onCreate = (xhr) => {};
sinon.FakeXMLHttpRequest.restore();
}
function testClock() {