From 182151984d6654d237fae4ef989419c36dce65b2 Mon Sep 17 00:00:00 2001 From: Jay Phelps Date: Mon, 13 Feb 2017 15:41:36 -0800 Subject: [PATCH] chore(ajax.patch): Adds test for ajax.patch --- spec/observables/dom/ajax-spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/observables/dom/ajax-spec.ts b/spec/observables/dom/ajax-spec.ts index 8ef9b8e668..854380f2bc 100644 --- a/spec/observables/dom/ajax-spec.ts +++ b/spec/observables/dom/ajax-spec.ts @@ -853,6 +853,21 @@ describe('Observable.ajax', () => { delete root.XMLHttpRequest.prototype.onerror; delete root.XMLHttpRequest.prototype.upload; }); + + describe('ajax.patch', () => { + it('should create an AjaxObservable with correct options', () => { + const body = { foo: 'bar' }; + const headers = { first: 'first' }; + // returns Observable, not AjaxObservable, so needs a cast + const { request } = Rx.Observable + .ajax.patch('/flibbertyJibbet', body, headers); + + expect(request.method).to.equal('PATCH'); + expect(request.url).to.equal('/flibbertyJibbet'); + expect(request.body).to.equal(body); + expect(request.headers).to.equal(headers); + }); + }); }); class MockXMLHttpRequest {