fix updated URL schema in JS unit tests
This commit is contained in:
parent
fe7d9a7ca0
commit
eac0131d5a
|
@ -85,7 +85,7 @@ describe('DeleteHandler tests', function() {
|
|||
// previous one was delete
|
||||
expect(fakeServer.requests.length).toEqual(1);
|
||||
var request = fakeServer.requests[0];
|
||||
expect(request.url).toEqual(OC.webroot + '/index.php/settings/ajax/dummyendpoint.php');
|
||||
expect(request.url).toEqual(OC.webroot + '/index.php/dummyendpoint.php/some_uid');
|
||||
});
|
||||
it('automatically deletes after timeout', function() {
|
||||
var handler = init(markCallback, removeCallback, undoCallback);
|
||||
|
@ -98,7 +98,7 @@ describe('DeleteHandler tests', function() {
|
|||
clock.tick(3000);
|
||||
expect(fakeServer.requests.length).toEqual(1);
|
||||
var request = fakeServer.requests[0];
|
||||
expect(request.url).toEqual(OC.webroot + '/index.php/settings/ajax/dummyendpoint.php');
|
||||
expect(request.url).toEqual(OC.webroot + '/index.php/dummyendpoint.php/some_uid');
|
||||
});
|
||||
it('deletes when deleteEntry is called', function() {
|
||||
var handler = init(markCallback, removeCallback, undoCallback);
|
||||
|
@ -107,7 +107,7 @@ describe('DeleteHandler tests', function() {
|
|||
handler.deleteEntry();
|
||||
expect(fakeServer.requests.length).toEqual(1);
|
||||
var request = fakeServer.requests[0];
|
||||
expect(request.url).toEqual(OC.webroot + '/index.php/settings/ajax/dummyendpoint.php');
|
||||
expect(request.url).toEqual(OC.webroot + '/index.php/dummyendpoint.php/some_uid');
|
||||
});
|
||||
it('cancels deletion when undo is clicked', function() {
|
||||
var handler = init(markCallback, removeCallback, undoCallback);
|
||||
|
@ -135,7 +135,7 @@ describe('DeleteHandler tests', function() {
|
|||
expect(fakeServer.requests.length).toEqual(0);
|
||||
});
|
||||
it('calls removeCallback after successful server side deletion', function() {
|
||||
fakeServer.respondWith(/\/index\.php\/settings\/ajax\/dummyendpoint.php/, [
|
||||
fakeServer.respondWith(/\/index\.php\/dummyendpoint.php\/some_uid/, [
|
||||
200,
|
||||
{ 'Content-Type': 'application/json' },
|
||||
JSON.stringify({status: 'success'})
|
||||
|
@ -148,7 +148,6 @@ describe('DeleteHandler tests', function() {
|
|||
expect(fakeServer.requests.length).toEqual(1);
|
||||
var request = fakeServer.requests[0];
|
||||
var query = OC.parseQueryString(request.requestBody);
|
||||
expect(query.paramid).toEqual('some_uid');
|
||||
|
||||
expect(removeCallback.calledOnce).toEqual(true);
|
||||
expect(undoCallback.notCalled).toEqual(true);
|
||||
|
@ -157,7 +156,7 @@ describe('DeleteHandler tests', function() {
|
|||
it('calls undoCallback and shows alert after failed server side deletion', function() {
|
||||
// stub t to avoid extra calls
|
||||
var tStub = sinon.stub(window, 't').returns('text');
|
||||
fakeServer.respondWith(/\/index\.php\/settings\/ajax\/dummyendpoint.php/, [
|
||||
fakeServer.respondWith(/\/index\.php\/dummyendpoint.php\/some_uid/, [
|
||||
200,
|
||||
{ 'Content-Type': 'application/json' },
|
||||
JSON.stringify({status: 'error', data: {message: 'test error'}})
|
||||
|
@ -171,7 +170,6 @@ describe('DeleteHandler tests', function() {
|
|||
expect(fakeServer.requests.length).toEqual(1);
|
||||
var request = fakeServer.requests[0];
|
||||
var query = OC.parseQueryString(request.requestBody);
|
||||
expect(query.paramid).toEqual('some_uid');
|
||||
|
||||
expect(removeCallback.notCalled).toEqual(true);
|
||||
expect(undoCallback.calledOnce).toEqual(true);
|
||||
|
|
Loading…
Reference in New Issue