all repos — archive/homestead @ 562b0533300ad5ad8cf4695aa7fc2b844b918169

My future indieweb platform

feat: load config from cwd and merge with defaults

Alan Pearce
commit

562b0533300ad5ad8cf4695aa7fc2b844b918169

parent

136ebe22452c0015770d9f0ac9d94d8941461816

1 file changed, 25 insertions(+), 25 deletions(-)

changed files
M test/app.test.jstest/app.test.js
@@ -1,49 +1,49 @@
-const test = require('ava') -const path = require('path') -const request = require('supertest') +const test = require("ava"); +const path = require("path"); +const request = require("supertest"); -const config = require('../src/modules/config.js') -config.posts.folder = path.resolve(__dirname, './data/') +process.chdir(path.resolve(__dirname, "./testsite/")); +const config = require(path.resolve(__dirname, "../src/modules/config.js")); -const app = require('../src/app.js') +const app = require("../src/app.js"); -test('homepage', t => { +test("homepage", t => { return request(app.listen()) - .get('/') + .get("/") .expect(200) .expect(/<title>Test Site<\/title>/) .expect(/<h1>Test Site<\/h1>/) .expect(/This is a test/) - .then(() => t.pass()) -}) + .then(() => t.pass()); +}); -test('post', t => { +test("post", t => { return request(app.listen()) - .get('/post/testfile') + .get("/post/testfile") .expect(200) .expect(/<h1>Lorem ipsum<\/h1>/) - .then(() => t.pass()) -}) + .then(() => t.pass()); +}); -test('post not found', t => { +test("post not found", t => { return request(app.listen()) - .get('/post/non-existant') + .get("/post/non-existant") .expect(404) .expect(/Post not found/) - .then(() => t.pass()) -}) + .then(() => t.pass()); +}); -test('tags', t => { +test("tags", t => { return request(app.listen()) - .get('/tag/a') + .get("/tag/a") .expect(200) .expect(/This is a test/) - .then(() => t.pass()) -}) + .then(() => t.pass()); +}); -test('tags not found', t => +test("tags not found", t => request(app.listen()) - .get('/tag/non-existant') + .get("/tag/non-existant") .expect(404) .expect(/tag non-existant not found/) - .then(() => t.pass())) + .then(() => t.pass()));