UNPKG

ipbcrawler

Version:

Package to mine forum data using the Invision Power Board platform.

66 lines (57 loc) 1.15 kB
const chai = require('chai') const homeExtraction = require('./../extractions/home') const $ = require('./../utils/mock')('index') /** * */ const home = homeExtraction($) /** * */ const { expect, assert } = chai describe('Home page', () => { /** * */ it('found the zones and ranks', () => { expect(home).to.have.all.keys('zones', 'ranks') }) /** * */ it('found all the zones', () => { expect(home.zones).to.have.lengthOf(6) }) /** * */ it('found all the categories of zones', () => { const { zones } = home /** * */ const categories = zones.reduce((p, c) => p.concat(c.categories), []) /** * */ categories.map(category => { /** * */ expect(category).to.have.all.keys('title', 'description', 'icon', 'subCategories') const { title, icon, subCategories } = category /** * */ assert.isAbove(title.length, 2, 'title is above two') /** * */ assert.isString(icon, 'icon not exists') /** * */ assert.isArray(subCategories, 'subcategories is not array') }) }) })