asyncTest('url and settings arguments', function() { var server = fakeServer('GET', '/foo?baz=qux', {foo: 'bar'}); raw('/foo', {data: {baz: 'qux'}}).then(function(result) { start(); deepEqual(result.response, {foo: 'bar'}); }); server.respond(); server.restore(); });
asyncTest('settings as only argument', function() { var server = fakeServer('GET', '/foo', {foo: 'bar'}); raw({url: '/foo'}).then(function(result) { start(); deepEqual(result.response, {foo: 'bar'}); }); server.respond(); server.restore(); });
asyncTest('rejects the promise when the textStatus of the fixture is not success', function() { fixtures.define('/post', { errorThrown: 'Unprocessable Entity', textStatus: 'error', jqXHR: {} }); start(); raw('/post').then(null, function(reason) { deepEqual(reason, fixtures.lookup('/post')); }); });
asyncTest('pulls from fixtures', function() { fixtures.define('/get', { response: { foo: 'bar' }, textStatus: 'success', jqXHR: {} }); raw('/get').then(function(result) { start(); deepEqual(result, fixtures.lookup('/get')); }); });
throws(function() { raw('/foo', { success: k, error: k }); });
throws(function() { raw('/foo', { error: k }); });