|
|
|
const { assert } = require('chai')
|
|
|
|
const fs = require('fs')
|
|
|
|
|
|
|
|
const PagesQuery = require('./../src/queries/pages.js')
|
|
|
|
|
|
|
|
describe('Page /index.md', function () {
|
|
|
|
|
|
|
|
const query = new PagesQuery('./ressources');
|
|
|
|
const results = query.find()
|
|
|
|
|
|
|
|
const page = results[2]
|
|
|
|
|
|
|
|
it('fields is Object', function() {
|
|
|
|
assert.isObject(page)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('fields has Blocks', function() {
|
|
|
|
assert.equal(page.blocks.block.length, 2)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('path', function() {
|
|
|
|
assert.equal(page.path, '/index.html')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('permalink', function() {
|
|
|
|
assert.equal(page.permalink, '')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Page /blog/index.md', function () {
|
|
|
|
|
|
|
|
const query = new PagesQuery('./ressources');
|
|
|
|
const results = query.find()
|
|
|
|
|
|
|
|
const page = results[1]
|
|
|
|
|
|
|
|
it('fields is object', function() {
|
|
|
|
assert.isObject(page)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('fields has Blocks', function() {
|
|
|
|
assert.equal(page.blocks.block.length, 2)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('path', function() {
|
|
|
|
assert.equal(page.path, '/blog.html')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('permalink', function() {
|
|
|
|
assert.equal(page.permalink, '/blog')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Page /blog/article.md', function () {
|
|
|
|
|
|
|
|
const query = new PagesQuery('./ressources');
|
|
|
|
const results = query.find()
|
|
|
|
|
|
|
|
const page = results[0]
|
|
|
|
|
|
|
|
it('fields is object', function() {
|
|
|
|
assert.isObject(page)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('path', function() {
|
|
|
|
assert.equal(page.path, '/blog/article.html')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('permalink', function() {
|
|
|
|
assert.equal(page.permalink, '/blog/article')
|
|
|
|
})
|
|
|
|
})
|