You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
core/test/pages.js

95 lines
2.3 KiB

const { assert } = require('chai')
const fs = require('fs')
const PagesQuery = require('./../src/queries/pages.js')
const configStore = require('./../src/config.js')
describe('Page /index.md', function () {
configStore.set('source', './ressources')
configStore.set('destination', './dist')
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 () {
configStore.set('source', './ressources')
configStore.set('destination', './dist')
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')
})
it('fields has media src', function() {
assert.deepEqual(page.media.src, {
"300": "/assets/88c010ea/4ca9b5f5/6024c57d/05899fae/a33d9a45/dog300.webp",
"500x100": "/assets/88c010ea/4ca9b5f5/6024c57d/05899fae/a33d9a45/dog500x100.webp",
"full": "/assets/88c010ea/4ca9b5f5/6024c57d/05899fae/a33d9a45/dog.webp"
})
})
})
describe('Page /blog/article.md', function () {
configStore.set('source', './ressources')
configStore.set('destination', './dist')
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')
})
it('fields has media src', function() {
assert.equal(page.media.src, '/assets/a6c45d17/11bf0a4e/a2b1d75d/dc85ca56/71c63294/dog.webp')
})
})