Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions test/GistsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,54 @@ const githubAccount = {
};

describe('Given a Github username', () => {
describe('when get all the public gists', () => {
let nextLink;
let allGitsFilterByGithub;

before(async () => {
await request
.head(`${githubAccount.baseUrl}/gists`)
.end(function(err, res){
nextLink = res.header.link;
});

allGitsFilterByGithub = await request
.get(`${githubAccount.baseUrl}/gists`);
});

it('then should exist a link', () => {
expect(nextLink).to.not.equal(undefined);
});

it('and return register should be thirty items', () => {
expect(allGitsFilterByGithub.body.length).to.equal(30);
});

describe('when it filters the items', () => {
let firstGitsResponse;
let hundredGitsResponse;
let tenGitsResponse;

before(async () => {
firstGitsResponse = await request
.get(`${githubAccount.baseUrl}/gists`)
.query({per_page: 10});

hundredGitsResponse = await request
.get(`${githubAccount.baseUrl}/gists`)
.query({per_page: 100});
});

it('then the body should contain ten items', () => {
expect(firstGitsResponse.body.length).to.equal(10);
});

it('and the body should contain one hundred items', () => {
expect(hundredGitsResponse.body.length).to.equal(100);
});
});
});

describe('when it creates a Gits', () => {
let createGitsResponse;
let gist;
Expand Down