ipbcrawler
Version:
Package to mine forum data using the Invision Power Board platform.
110 lines (94 loc) • 1.63 kB
JavaScript
const chai = require('chai')
const listTopicsExtraction = require('./../extractions/list-topics')
const { pagination } = listTopicsExtraction
const $ = require('./../utils/mock')('category-topics')
/**
*
*/
const listTopics = listTopicsExtraction($)
const paginationAccess = pagination($, 'test')
/**
*
*/
const { expect, assert } = chai
describe('Category page [List topics] ', () => {
/**
*
*/
it('Found topics', () => {
/**
*
*/
expect(listTopics).to.have.property('topics')
})
/**
*
*/
it('Found the all topics', () => {
/**
*
*/
const { topics } = listTopics
/**
*
*/
topics.map(topic => {
/**
*
*/
expect(topic).to.have.all.keys('id', 'url', 'title')
/**
*
*/
const { id, url, title } = topic
/**
*
*/
assert.isString(id),
/**
*
*/
assert.isString(title)
/**
*
*/
assert.isAbove(url.length, 3)
})
})
/**
*
*/
it('Found the all pagination', () => {
/**
*
*/
expect(paginationAccess).to.have.property('pagination')
/**
*
*/
assert.isArray(paginationAccess.pagination)
/**
*
*/
expect(paginationAccess.pagination).to.have.lengthOf(2)
/**
*
*/
paginationAccess
.pagination
.map(paginate => {
/**
*
*/
expect(paginate).to.have.all.keys('url', 'page')
/**
*
*/
assert.isNumber(paginate.page)
/**
*
*/
assert.isAbove(paginate.url.length, 3)
})
})
})