How to use chai method in apimocker

Best JavaScript code snippet using apimocker

mixer-filter.js

Source:mixer-filter.js Github

copy

Full Screen

1'use strict';2require('jsdom-global')();3const chai = require('chai');4const dom = require('../mock/dom');5const mixitup = require('../../dist/mixitup.js');6chai.use(require('chai-shallow-deep-equal'));7chai.use(require('chai-as-promised'));8describe('mixitup.Mixer', () => {9 describe('#filter()', () => {10 let container = dom.getContainer();11 let mixer = mixitup(container);12 it('should accept a class selector', () => {13 let matching = Array.prototype.slice.call(container.querySelectorAll('.category-a'));14 return mixer.filter('.category-a')15 .then(state => {16 chai.assert.equal(state.totalShow, matching.length);17 chai.assert.deepEqual(state.show, matching);18 chai.assert.deepEqual(state.matching, matching);19 });20 });21 it('should accept an attribute selector', () => {22 let matching = Array.prototype.slice.call(container.querySelectorAll('[data-category~="a"]'));23 return mixer.filter('[data-category~="a"]')24 .then(state => {25 chai.assert.equal(state.totalShow, matching.length);26 chai.assert.deepEqual(state.show, matching);27 chai.assert.deepEqual(state.matching, matching);28 });29 });30 it('should accept a compound OR class selector', () => {31 let matching = Array.prototype.slice.call(container.querySelectorAll('.category-a, .category-b'));32 return mixer.filter('.category-a, .category-b')33 .then(state => {34 chai.assert.equal(state.totalShow, matching.length);35 chai.assert.deepEqual(state.show, matching);36 chai.assert.deepEqual(state.matching, matching);37 });38 });39 it('should accept a compound AND class selector', () => {40 let matching = Array.prototype.slice.call(container.querySelectorAll('.category-a.category-c'));41 return mixer.filter('.category-a.category-c')42 .then(state => {43 chai.assert.equal(state.totalShow, matching.length);44 chai.assert.deepEqual(state.show, matching);45 chai.assert.deepEqual(state.matching, matching);46 });47 });48 it('should accept a compound OR attribute selector', () => {49 let matching = Array.prototype.slice.call(container.querySelectorAll('[data-category~="a"], [data-category~="c"]'));50 return mixer.filter('[data-category~="a"], [data-category~="c"]')51 .then(state => {52 chai.assert.equal(state.totalShow, matching.length);53 chai.assert.deepEqual(state.show, matching);54 chai.assert.deepEqual(state.matching, matching);55 });56 });57 it('should accept a compound AND attribute selector', () => {58 let matching = Array.prototype.slice.call(container.querySelectorAll('[data-category~="a"][data-category~="c"]'));59 return mixer.filter('[data-category~="a"][data-category~="c"]')60 .then(state => {61 chai.assert.equal(state.totalShow, matching.length);62 chai.assert.equal(state.totalShow, 1);63 chai.assert.deepEqual(state.show, matching);64 chai.assert.deepEqual(state.matching, matching);65 });66 });67 it('should accept "none"', () => {68 return mixer.filter('none')69 .then(state => {70 chai.assert.equal(state.totalShow, 0);71 chai.assert.equal(state.hasFailed, false);72 chai.assert.deepEqual(state.hide, Array.prototype.slice.call(container.children));73 chai.assert.equal(state.activeFilter.selector, '');74 });75 });76 it('should accept "all"', () => {77 return mixer.filter('all')78 .then(state => {79 chai.assert.deepEqual(state.show, Array.prototype.slice.apply(container.children));80 chai.assert.deepEqual(state.show, state.targets);81 });82 });83 it('should fail if queried with a non matching selector', () => {84 return mixer.filter('.non-mathing-selector')85 .then(state => {86 chai.assert.deepEqual(state.show, []);87 chai.assert.equal(state.hasFailed, true);88 });89 });90 it('should accept a single element', () => {91 let el = container.firstElementChild;92 return mixer.filter(el)93 .then(state => {94 chai.assert.deepEqual(state.show, [el]);95 chai.assert.equal(state.activeFilter.selector, '');96 chai.assert.deepEqual(state.activeFilter.collection, [el]);97 });98 });99 it('should accept a collection of elements', () => {100 let collection = [101 container.firstElementChild,102 container.lastElementChild103 ];104 return mixer.filter(collection)105 .then(state => {106 chai.assert.deepEqual(state.show, collection);107 chai.assert.equal(state.activeFilter.selector, '');108 chai.assert.deepEqual(state.activeFilter.collection, collection);109 });110 });111 it('should interpret `null` as hide all', () => {112 return mixer.filter(null)113 .then(state => {114 chai.assert.deepEqual(state.show, []);115 chai.assert.equal(state.activeFilter.selector, '');116 chai.assert.deepEqual(state.activeFilter.collection, []);117 });118 });119 it('should interpret `[]` as hide all', () => {120 return mixer.filter(null)121 .then(state => {122 chai.assert.deepEqual(state.show, []);123 chai.assert.equal(state.activeFilter.selector, '');124 chai.assert.deepEqual(state.activeFilter.collection, []);125 });126 });127 it('should accept a full CommandFilter object, allowing for inverse filtering via selector', () => {128 let command = {129 selector: '.category-a',130 action: 'hide'131 };132 let collection = Array.prototype.slice.call(container.querySelectorAll(':not(.category-a)'));133 return mixer.filter(command)134 .then(state => {135 chai.assert.deepEqual(state.show, collection);136 chai.assert.equal(state.activeFilter.selector, '.category-a');137 chai.assert.equal(state.activeFilter.action, 'hide');138 });139 });140 it('should accept a full CommandFilter object, allowing for inverse filtering via a collection', () => {141 let el = container.querySelector('.category-a.category-c');142 let command = {143 collection: [el],144 action: 'hide'145 };146 let collection = Array.prototype.slice.call(container.querySelectorAll(':not(.category-a.category-c)'));147 return mixer.filter(command)148 .then(state => {149 chai.assert.deepEqual(state.show, collection);150 chai.assert.deepEqual(state.activeFilter.collection, [el]);151 chai.assert.equal(state.activeFilter.action, 'hide');152 });153 });154 it('should accept a callback function which is invoked after filtering', () => {155 let matching = Array.prototype.slice.call(container.querySelectorAll('.category-a'));156 let promise = new Promise(resolve => mixer.filter('.category-a', resolve));157 chai.assert.isFulfilled(promise);158 return promise159 .then(state => {160 chai.assert.equal(state.totalShow, matching.length);161 chai.assert.deepEqual(state.show, matching);162 chai.assert.deepEqual(state.matching, matching);163 });164 });165 it('should return a promise which is resolved after filtering', () => {166 let matching = Array.prototype.slice.call(container.querySelectorAll('.category-a'));167 return mixer.filter('.category-a')168 .then(state => {169 chai.assert.equal(state.totalShow, matching.length);170 chai.assert.deepEqual(state.show, matching);171 chai.assert.deepEqual(state.matching, matching);172 });173 });174 it('should accept a boolean allowing toggling off of animation', () => {175 let matching = Array.prototype.slice.call(container.querySelectorAll('.category-a'));176 return mixer.filter('.category-a', false)177 .then(state => {178 chai.assert.equal(state.totalShow, matching.length);179 chai.assert.deepEqual(state.show, matching);180 chai.assert.deepEqual(state.matching, matching);181 });182 });183 it('should throw an error if both a selector and a collection are provided', () => {184 let command = {185 collection: [],186 selector: '.selector'187 };188 chai.assert.throws(() => {189 mixer.filter(command);190 }, Error, mixitup.messages.errorFilterInvalidArguments());191 });192 });193});194describe('mixitup.Mixer', () => {195 describe('#hide()', () => {196 let container = dom.getContainer();197 let mixer = mixitup(container);198 it('should hide all elements', () => {199 return mixer.hide()200 .then(state => {201 chai.assert.equal(state.totalShow, 0);202 chai.assert.equal(state.totalHide, state.targets.length);203 chai.assert.equal(state.activeFilter.selector, '');204 });205 });206 });207});208describe('mixitup.Mixer', () => {209 describe('#show()', () => {210 let container = dom.getContainer();211 let mixer = mixitup(container);212 it('should show all elements', () => {213 return mixer.filter('.category-a')214 .then(mixer.show)215 .then(state => {216 chai.assert.equal(state.totalShow, state.targets.length);217 chai.assert.equal(state.totalHide, 0);218 chai.assert.equal(state.activeFilter.selector, '.mix');219 });220 });221 });...

Full Screen

Full Screen

matches.test.ts

Source:matches.test.ts Github

copy

Full Screen

1import * as sinon from 'sinon';2import * as chai from 'chai';3// @ts-ignore4import chaiHttp = require('chai-http');5import { app } from '../app';6// import Example from '../database/models/ExampleModel';7import Matches from '../database/models/matches';8import { Response } from 'superagent';9chai.use(chaiHttp);10const { expect } = chai;11const matchMock = {12 id: 1,13 homeTeam: 1,14 homeTeamGoals: 1,15 awayTeam: 8,16 awayTeamGoals: 1,17 inProgress: false,18 teamHome: {19 teamName: 'São Paulo'20 },21 teamAway: {22 teamName: 'Grêmio'23 }24}25const matchInProgressMock = {26 id: 1,27 homeTeam: 1,28 homeTeamGoals: 1,29 awayTeam: 8,30 awayTeamGoals: 1,31 inProgress: true,32 teamHome: {33 teamName: 'São Paulo'34 },35 teamAway: {36 teamName: 'Grêmio'37 }38}39const matchCreateMock = {40 id: 50,41 homeTeam: 1,42 homeTeamGoals: 1,43 awayTeam: 2,44 awayTeamGoals: 1,45 inProgress: true,46}47const correctToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjoxLCJ1c2VybmFtZSI6IkFkbWluIiwicm9sZSI6ImFkbWluIiwiZW1haWwiOiJhZG1pbkBhZG1pbi5jb20iLCJwYXNzd29yZCI6IiQyYSQwOCR4aS5IeGsxY3pBTzBuWlIuLkIzOTN1MTBhRUQwUlExTjNQQUVYUTdIeHRMaktQRVpCdS5QVyJ9LCJpYXQiOjE2NjE0NTEyNzgsImV4cCI6MTY2MjA1NjA3OH0.wstjZC2jFxDzL-NdEf0DsJM_YrgotOIYvCR_TCDysFE'48describe('Returns correct matches list', () => {49 let chaiHttpResponse: Response;50 beforeEach(async () => {51 sinon52 .stub(Matches, "findAll")53 .resolves([matchMock as any]);54 });55 afterEach(()=>{56 (Matches.findAll as sinon.SinonStub).restore();57 })58 it('returns status 200', async () => {59 chaiHttpResponse = await chai60 .request(app)61 .get('/matches')62 expect(chaiHttpResponse.status).to.equal(200)63 });64 it('returns correct matches list', async () => {65 chaiHttpResponse = await chai66 .request(app)67 .get('/matches')68 const [matches] = chaiHttpResponse.body;69 expect(matches.id).to.equal(matchMock.id);70 expect(matches.homeTeam).to.equal(matchMock.homeTeam);71 expect(matches.homeTeamGoals).to.equal(matchMock.homeTeamGoals);72 expect(matches.awayTeam).to.equal(matchMock.awayTeam);73 expect(matches.awayTeamGoals).to.equal(matchMock.awayTeamGoals);74 expect(matches.inProgress).to.equal(matchMock.inProgress);75 expect(matches.teamHome.teamName).to.equal(matchMock.teamHome.teamName);76 expect(matches.teamAway.teamName).to.equal(matchMock.teamAway.teamName);77 });78});79describe('Returns correct matches list by activity', () => {80 let chaiHttpResponse: Response;81 beforeEach(async () => {82 sinon83 .stub(Matches, "findAll")84 .resolves([matchInProgressMock as any]);85 });86 afterEach(()=>{87 (Matches.findAll as sinon.SinonStub).restore();88 })89 it('returns status 200', async () => {90 chaiHttpResponse = await chai91 .request(app)92 .get('/matches/?inProgress=true')93 expect(chaiHttpResponse.status).to.equal(200)94 });95 it('returns correct in progress matches list', async () => {96 chaiHttpResponse = await chai97 .request(app)98 .get('/matches/?inProgress=true')99 const [matches] = chaiHttpResponse.body;100 expect(matches.id).to.equal(matchInProgressMock.id);101 expect(matches.homeTeam).to.equal(matchInProgressMock.homeTeam);102 expect(matches.homeTeamGoals).to.equal(matchInProgressMock.homeTeamGoals);103 expect(matches.awayTeam).to.equal(matchInProgressMock.awayTeam);104 expect(matches.awayTeamGoals).to.equal(matchInProgressMock.awayTeamGoals);105 expect(matches.inProgress).to.equal(matchInProgressMock.inProgress);106 expect(matches.teamHome.teamName).to.equal(matchInProgressMock.teamHome.teamName);107 expect(matches.teamAway.teamName).to.equal(matchInProgressMock.teamAway.teamName);108 });109});110describe('Returns correct when creating match', () => {111 let chaiHttpResponse: Response;112 beforeEach(async () => {113 sinon114 .stub(Matches, "create")115 .resolves(matchCreateMock as any)116 });117 afterEach(()=>{118 (Matches.create as sinon.SinonStub).restore();119 })120 it('returns status 201', async () => {121 chaiHttpResponse = await chai122 .request(app)123 .post('/matches')124 .send({125 homeTeam: 1,126 homeTeamGoals: 1,127 awayTeam: 2,128 awayTeamGoals: 1,129 inProgress: true,130 })131 .set('authorization', correctToken)132 expect(chaiHttpResponse.status).to.equal(201)133 });134 it('returns correct created match response', async () => {135 chaiHttpResponse = await chai136 .request(app)137 .post('/matches')138 .send({139 homeTeam: 1,140 homeTeamGoals: 1,141 awayTeam: 2,142 awayTeamGoals: 1,143 inProgress: true,144 })145 .set('authorization', correctToken)146 const match = chaiHttpResponse.body;147 148 expect(match.id).to.equal(matchCreateMock.id);149 expect(match.homeTeam).to.equal(matchCreateMock.homeTeam);150 expect(match.homeTeamGoals).to.equal(matchCreateMock.homeTeamGoals);151 expect(match.awayTeam).to.equal(matchCreateMock.awayTeam);152 expect(match.awayTeamGoals).to.equal(matchCreateMock.awayTeamGoals);153 expect(match.inProgress).to.equal(matchCreateMock.inProgress);154 });155});156describe('Returns correct when failing to create a match', () => {157 let chaiHttpResponse: Response;158 beforeEach(async () => {159 sinon160 .stub(Matches, "create")161 .resolves(matchCreateMock as any)162 });163 afterEach(()=>{164 (Matches.create as sinon.SinonStub).restore();165 })166 it('returns status 401 when team are duplicated', async () => {167 chaiHttpResponse = await chai168 .request(app)169 .post('/matches')170 .send({171 homeTeam: 1,172 homeTeamGoals: 1,173 awayTeam: 1,174 awayTeamGoals: 1,175 inProgress: true,176 })177 .set('authorization', correctToken)178 expect(chaiHttpResponse.status).to.equal(401)179 });180 it('returns correct when team are duplicated', async () => {181 chaiHttpResponse = await chai182 .request(app)183 .post('/matches')184 .send({185 homeTeam: 1,186 homeTeamGoals: 1,187 awayTeam: 1,188 awayTeamGoals: 1,189 inProgress: true,190 })191 .set('authorization', correctToken)192 const response = chaiHttpResponse.body;193 194 expect(response.message).to.equal('It is not possible to create a match with two equal teams');195 });196 it('returns status 404 when missing a team', async () => {197 chaiHttpResponse = await chai198 .request(app)199 .post('/matches')200 .send({201 homeTeam: 1,202 homeTeamGoals: 1,203 awayTeamGoals: 1,204 inProgress: true,205 })206 .set('authorization', correctToken)207 expect(chaiHttpResponse.status).to.equal(404)208 });209 it('returns correct when missing a team', async () => {210 chaiHttpResponse = await chai211 .request(app)212 .post('/matches')213 .send({214 homeTeam: 1,215 homeTeamGoals: 1,216 awayTeamGoals: 1,217 inProgress: true,218 })219 .set('authorization', correctToken)220 const response = chaiHttpResponse.body;221 222 expect(response.message).to.equal('There is no team with such id!');223 });224});225describe('Returns correct when updating a match', () => {226 let chaiHttpResponse: Response;227 beforeEach(async () => {228 sinon229 .stub(Matches, "update")230 .resolves([matchMock.id, [matchMock as any]])231 });232 afterEach(()=>{233 (Matches.update as sinon.SinonStub).restore();234 })235 it('returns status 200', async () => {236 chaiHttpResponse = await chai237 .request(app)238 .patch('/matches/1/finish')239 .set('authorization', correctToken)240 expect(chaiHttpResponse.status).to.equal(200)241 });242 it('returns correct message when updated', async () => {243 chaiHttpResponse = await chai244 .request(app)245 .patch('/matches/1/finish')246 .set('authorization', correctToken)247 const response = chaiHttpResponse.body;248 249 expect(response.message).to.equal('Finished');250 });251});252describe('Returns correct when failing to update a match', () => {253 let chaiHttpResponse: Response;254 beforeEach(async () => {255 sinon256 .stub(Matches, "update")257 .resolves(undefined)258 });259 afterEach(()=>{260 (Matches.update as sinon.SinonStub).restore();261 })262 it('returns status 404', async () => {263 chaiHttpResponse = await chai264 .request(app)265 .patch('/matches/999999/finish')266 .set('authorization', correctToken)267 expect(chaiHttpResponse.status).to.equal(404)268 });269 it('returns correct message when failing to update', async () => {270 chaiHttpResponse = await chai271 .request(app)272 .patch('/matches/999999/finish')273 .set('authorization', correctToken)274 const response = chaiHttpResponse.body;275 276 expect(response.message).to.equal('match not found');277 });278});279describe('Returns correct when updating goals on a match', () => {280 let chaiHttpResponse: Response;281 beforeEach(async () => {282 sinon283 .stub(Matches, "update")284 .resolves([matchMock.id, [matchMock as any]])285 });286 afterEach(()=>{287 (Matches.update as sinon.SinonStub).restore();288 })289 it('returns status 200', async () => {290 chaiHttpResponse = await chai291 .request(app)292 .patch('/matches/1')293 .set('authorization', correctToken)294 .send({295 homeTeamGoals: 2,296 awayTeamGoals: 2297 })298 expect(chaiHttpResponse.status).to.equal(200)299 });300 it('returns correct message when updated goals', async () => {301 chaiHttpResponse = await chai302 .request(app)303 .patch('/matches/1')304 .set('authorization', correctToken)305 .send({306 homeTeamGoals: 2,307 awayTeamGoals: 2308 })309 const response = chaiHttpResponse.body;310 311 expect(response.message).to.equal('Finished');312 });313});314describe('Returns correct when failing to update goals on a match', () => {315 let chaiHttpResponse: Response;316 beforeEach(async () => {317 sinon318 .stub(Matches, "update")319 .resolves(undefined)320 });321 afterEach(()=>{322 (Matches.update as sinon.SinonStub).restore();323 })324 it('returns status 404', async () => {325 chaiHttpResponse = await chai326 .request(app)327 .patch('/matches/999999')328 .set('authorization', correctToken)329 .send({330 homeTeamGoals: 2,331 awayTeamGoals: 2332 })333 expect(chaiHttpResponse.status).to.equal(404)334 });335 it('returns correct message when failing to update goals', async () => {336 chaiHttpResponse = await chai337 .request(app)338 .patch('/matches/999999')339 .set('authorization', correctToken)340 .send({341 homeTeamGoals: 2,342 awayTeamGoals: 2343 })344 const response = chaiHttpResponse.body;345 346 expect(response.message).to.equal('match not found');347 });...

Full Screen

Full Screen

teams.test.ts

Source:teams.test.ts Github

copy

Full Screen

1import * as sinon from 'sinon';2import * as chai from 'chai';3// @ts-ignore4import chaiHttp = require('chai-http');5import { app } from '../app';6// import Example from '../database/models/ExampleModel';7import Teams from '../database/models/teams';8import { ITeams } from '../interfaces/ITeams';9import { Response } from 'superagent';10chai.use(chaiHttp);11const { expect } = chai;12const teamMock: ITeams = {13 id: 1,14 teamName: 'Avaí/Kindermann'15}16describe('Returns correct teams list', () => {17 let chaiHttpResponse: Response;18 beforeEach(async () => {19 sinon20 .stub(Teams, "findAll")21 .resolves([teamMock as Teams]);22 });23 afterEach(()=>{24 (Teams.findAll as sinon.SinonStub).restore();25 })26 it('returns status 200', async () => {27 chaiHttpResponse = await chai28 .request(app)29 .get('/teams')30 expect(chaiHttpResponse.status).to.equal(200)31 });32 it('returns correct teams list', async () => {33 chaiHttpResponse = await chai34 .request(app)35 .get('/teams')36 const [teams] = chaiHttpResponse.body as ITeams[];37 expect(teams.id).to.equal(teamMock.id);38 expect(teams.teamName).to.equal(teamMock.teamName);39 });40});41describe('Returns correct when list fails', () => {42 let chaiHttpResponse: Response;43 beforeEach(async () => {44 sinon45 .stub(Teams, "findAll")46 .resolves(undefined);47 });48 afterEach(()=>{49 (Teams.findAll as sinon.SinonStub).restore();50 })51 it('returns status 500', async () => {52 chaiHttpResponse = await chai53 .request(app)54 .get('/teams')55 expect(chaiHttpResponse.status).to.equal(500)56 });57 it('returns correct message', async () => {58 chaiHttpResponse = await chai59 .request(app)60 .get('/teams')61 const response = chaiHttpResponse.body;62 expect(response.message).to.equal('Server Error');63 });64});65describe('Returns correct teams by id', () => {66 let chaiHttpResponse: Response;67 beforeEach(async () => {68 sinon69 .stub(Teams, "findByPk")70 .resolves(teamMock as Teams);71 });72 afterEach(()=>{73 (Teams.findByPk as sinon.SinonStub).restore();74 })75 it('returns status 200', async () => {76 chaiHttpResponse = await chai77 .request(app)78 .get('/teams/1')79 expect(chaiHttpResponse.status).to.equal(200)80 });81 it('returns correct team', async () => {82 chaiHttpResponse = await chai83 .request(app)84 .get('/teams/1')85 const team = chaiHttpResponse.body as ITeams;86 expect(team.id).to.equal(teamMock.id);87 expect(team.teamName).to.equal(teamMock.teamName);88 });89});90describe('Returns correct message when no team is found', () => {91 let chaiHttpResponse: Response;92 beforeEach(async () => {93 sinon94 .stub(Teams, "findByPk")95 .resolves(undefined);96 });97 afterEach(()=>{98 (Teams.findByPk as sinon.SinonStub).restore();99 })100 it('returns status 404', async () => {101 chaiHttpResponse = await chai102 .request(app)103 .get('/teams/99999')104 expect(chaiHttpResponse.status).to.equal(404)105 });106 it('returns correct message', async () => {107 chaiHttpResponse = await chai108 .request(app)109 .get('/teams/99999')110 const response = chaiHttpResponse.body;111 expect(response.message).to.equal('team not found');112 });...

Full Screen

Full Screen

request.spec.js

Source:request.spec.js Github

copy

Full Screen

1var chai = require('chai');2var chaiHttp = require('chai-http');3const baseUrl = 'https://api.github.com/users/';4const username = 'Anna18921';5chai.use(chaiHttp);6describe('Test Endpoints API Github V3', () => {7 it('should GET user by username', (done) => {8 chai9 .request(baseUrl)10 .get(username)11 .end(function (err, res) {12 chai.expect(res.statusCode).to.equal(200);13 chai.should(res.body);14 chai.expect(res.body).to.be.a('object');15 chai.expect(res.body.name).to.be.a('string');16 chai.expect(res.body.login).to.be.a('string');17 chai.expect(res.body.avatar_url).to.be.a('string');18 chai.expect(res.body.followers).to.be.a('number');19 chai.expect(res.body.location).to.be.a('string');20 chai.expect(res.body.bio).to.be.a('string');21 chai.expect(res.body.company).to.be.a('string');22 chai.expect(res.body.public_repos).to.be.a('number');23 done();24 });25 });26 it('must GET repositories GitHub User if there are any repositories', (done) => {27 chai28 .request(baseUrl)29 .get(`${username}/repos`)30 .end(function (err, res) {31 chai.expect(res.statusCode).to.equal(200);32 chai.should(res.body[0]);33 chai.expect(res.body).to.be.a('array');34 chai.expect(res.body[0].id).to.be.a('number');35 chai.expect(res.body[0].name).to.be.a('string');36 chai.expect(res.body[0].private).to.be.a('boolean');37 chai.expect(res.body[0].html_url).to.be.a('string');38 chai.expect(res.body[0].description).to.be.a('string');39 chai.expect(res.body[0].fork).to.be.a('boolean');40 chai.expect(res.body[0].stargazers_count).to.be.a('number');41 done();42 });43 });44 it('GET repositories starred GitHub', (done) => {45 chai46 .request(baseUrl)47 .get(`${username}/starred`)48 .end(function (err, res) {49 chai.expect(res.statusCode).to.equal(200);50 chai.should(res.body[0]);51 chai.expect(res.body).to.be.a('array');52 chai.expect(res.body[0].id).to.be.a('number');53 chai.expect(res.body[0].name).to.be.a('string');54 chai.expect(res.body[0].private).to.be.a('boolean');55 chai.expect(res.body[0].html_url).to.be.a('string');56 chai.expect(res.body[0].description).to.be.a('string');57 chai.expect(res.body[0].fork).to.be.a('boolean');58 chai.expect(res.body[0].stargazers_count).to.be.a('number');59 done();60 });61 });...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run apimocker automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful