it("should cache the response in the $http cache", (): void => { const httpGet: SinonStub = sinon.stub($http, "get").returns({ then(): void { // Do nothing } }); categoryModel.all(); httpGet.firstCall.args[1].should.have.a.property("cache").that.is.not.false; });
it("should return a list of all categories without their children", (): void => { $httpBackend.when("GET", expectedUrl).respond(200, expectedResponse); categoryModel.all(1).should.eventually.equal(expectedResponse); $httpBackend.flush(); });
it("should dispatch a GET request to /categories?parent={parent}", (): void => { $httpBackend.expect("GET", expectedUrl).respond(200); categoryModel.all(1); $httpBackend.flush(); });