Commit fe2e8dba authored by Phil Hughes's avatar Phil Hughes

fixed infinite loop crashing tests

parent 4cea24f8
...@@ -47,12 +47,12 @@ describe('pager', () => { ...@@ -47,12 +47,12 @@ describe('pager', () => {
}); });
describe('getOld', () => { describe('getOld', () => {
const urlRegex = /\/some_list(.*)$/; const urlRegex = /(.*)some_list(.*)$/;
let mock; let mock;
function mockSuccess() { function mockSuccess() {
mock.onGet(urlRegex).reply(200, { mock.onGet(urlRegex).reply(200, {
count: 20, count: 0,
html: '', html: '',
}); });
} }
...@@ -65,9 +65,9 @@ describe('pager', () => { ...@@ -65,9 +65,9 @@ describe('pager', () => {
setFixtures('<div class="content_list" data-href="/some_list"></div><div class="loading"></div>'); setFixtures('<div class="content_list" data-href="/some_list"></div><div class="loading"></div>');
spyOn(axios, 'get').and.callThrough(); spyOn(axios, 'get').and.callThrough();
Pager.init();
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
Pager.init();
}); });
afterEach(() => { afterEach(() => {
...@@ -119,10 +119,15 @@ describe('pager', () => { ...@@ -119,10 +119,15 @@ describe('pager', () => {
Pager.getOld(); Pager.getOld();
setTimeout(() => { setTimeout(() => {
const [url, params] = $.ajax.calls.argsFor(0); const [url, params] = axios.get.calls.argsFor(0);
console.log(url, params);
// expect(data).toBe('limit=20&offset=100'); expect(params).toEqual({
// expect(url).toBe('/some_list'); params: {
limit: 20,
offset: 100,
},
});
expect(url).toBe('/some_list');
done(); done();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment