Skip to content

Commit

Permalink
Merge pull request #119 from Ilhasoft/issue/108
Browse files Browse the repository at this point in the history
Fix #108
  • Loading branch information
Douglas Paz committed Jul 9, 2018
2 parents b76366c + 3a9ac72 commit 9480a9f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/api/utils/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default class List {

async reset() {
this.items = [];
this.deletions = [];
this.nextEntryPoint = this.initial;
}

Expand Down
41 changes: 36 additions & 5 deletions src/api/utils/List.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,41 @@ jest.mock('../request');
import List from './List';

describe('API List', () => {
test('repositories test', async () => {
const list = new List('/repositories/');
await list.next();
expect(list.items).toHaveLength(20);
expect(list.hasNext).toBeTruthy();
let list;
const initial = '/repositories/';
beforeEach(() => {
list = new List(initial);
});

describe('next', () => {
beforeEach(async () => {
await list.next();
});

test('has items', () => {
expect(list.items).toHaveLength(20);
});

test('has next', () => {
expect(list.hasNext).toBeTruthy();
});

describe('reset', () => {
beforeEach(() => {
list.reset();
});

test('nextEntryPoint is initial', () => {
expect(list.nextEntryPoint).toBe(initial);
});

test('empty items', () => {
expect(list.items).toHaveLength(0);
});

test('empty deletions', () => {
expect(list.deletions).toHaveLength(0);
});
});
});
});

0 comments on commit 9480a9f

Please sign in to comment.