diff --git a/package.json b/package.json index e6e6f07e2..7933d47c9 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", "http-server": "^0.11.1", "mocha": "^6.1.4", "nyc": "^14.0.0", diff --git a/test/cli/cases/build.config.default/build.config.default.spec.js b/test/cli/cases/build.config.default/build.config.default.spec.js index a3658285a..0c4fa90a3 100644 --- a/test/cli/cases/build.config.default/build.config.default.spec.js +++ b/test/cli/cases/build.config.default/build.config.default.spec.js @@ -17,23 +17,23 @@ const runSmokeTest = require('../../smoke-test'); const TestBed = require('../../test-bed'); -describe('Build Greenwood With: ', async () => { +describe('Build Greenwood With: ', async function() { + const LABEL = 'Empty Configuration and Default Workspace'; let setup; - let context; - before(async () => { + before(async function() { setup = new TestBed(); - context = setup.setupTestBed(__dirname); + this.context = setup.setupTestBed(__dirname); }); - describe('Empty Configuration and Default Workspace', () => { - before(async () => { + describe(LABEL, function() { + before(async function() { await setup.runGreenwoodCommand('build'); }); - - it('should pass all smoke tests', async () => { - await runSmokeTest(context, setup, 'Empty Configuration and Default Workspace'); - }); + runSmokeTest(['public', 'index', 'not-found', 'hello'], LABEL); + }); + + after(function() { + setup.teardownTestBed(); }); - }); \ No newline at end of file diff --git a/test/cli/cases/build.config.error-public-path/build.config.error-public-path.spec.js b/test/cli/cases/build.config.error-public-path/build.config.error-public-path.spec.js index e107a73bf..869fdbf8d 100644 --- a/test/cli/cases/build.config.error-public-path/build.config.error-public-path.spec.js +++ b/test/cli/cases/build.config.error-public-path/build.config.error-public-path.spec.js @@ -28,7 +28,7 @@ describe('Build Greenwood With: ', () => { }); describe('Custom Configuration with a bad value for Public Path', () => { - it('should throw an error that publicPath must be a dtring', async () => { + it('should throw an error that publicPath must be a string', async () => { try { await setup.runGreenwoodCommand('build'); } catch (err) { @@ -36,5 +36,9 @@ describe('Build Greenwood With: ', () => { } }); }); + + after(function() { + setup.teardownTestBed(); + }); }); \ No newline at end of file diff --git a/test/cli/cases/build.config.error-workspace/build.config.error-workspace.spec.js b/test/cli/cases/build.config.error-workspace/build.config.error-workspace.spec.js index 34dcc99bf..b90e95584 100644 --- a/test/cli/cases/build.config.error-workspace/build.config.error-workspace.spec.js +++ b/test/cli/cases/build.config.error-workspace/build.config.error-workspace.spec.js @@ -28,7 +28,7 @@ describe('Build Greenwood With: ', () => { }); describe('Custom Configuration with a bad value for Workspace', () => { - it('should throw an error that workspace path must be a dtring', async () => { + it('should throw an error that workspace path must be a string', async () => { try { await setup.runGreenwoodCommand('build'); } catch (err) { @@ -37,4 +37,8 @@ describe('Build Greenwood With: ', () => { }); }); + after(function() { + setup.teardownTestBed(); + }); + }); \ No newline at end of file diff --git a/test/cli/cases/build.config.workspace-custom/build.config.workspace-custom.spec.js b/test/cli/cases/build.config.workspace-custom/build.config.workspace-custom.spec.js index c3a36a0c0..e09e3a355 100644 --- a/test/cli/cases/build.config.workspace-custom/build.config.workspace-custom.spec.js +++ b/test/cli/cases/build.config.workspace-custom/build.config.workspace-custom.spec.js @@ -19,23 +19,23 @@ const runSmokeTest = require('../../smoke-test'); const TestBed = require('../../test-bed'); -describe('Build Greenwood With: ', () => { +describe('Build Greenwood With: ', function() { + const LABEL = 'Custom Configuration for Workspace (www) and Default Greenwood configuration'; let setup; - let context; - before(async () => { + before(async function() { setup = new TestBed(); - context = setup.setupTestBed(__dirname); + this.context = setup.setupTestBed(__dirname); }); - describe('Custom Configuration for Workspace (www) and Default Greenwood configuration', () => { - before(async () => { + describe(LABEL, function() { + before(async function() { await setup.runGreenwoodCommand('build'); }); - - it('should pass all smoke tests', async () => { - await runSmokeTest(context, setup, 'Custom Configuration for Workspace (www) and Default Greenwood configuration'); - }); + runSmokeTest(['public', 'index', 'not-found'], LABEL); }); + after(function() { + setup.teardownTestBed(); + }); }); \ No newline at end of file diff --git a/test/cli/cases/build.default.workspace-nested/build.default.workspace-nested.spec.js b/test/cli/cases/build.default.workspace-nested/build.default.workspace-nested.spec.js index d965d06c1..3fa00e3ca 100644 --- a/test/cli/cases/build.default.workspace-nested/build.default.workspace-nested.spec.js +++ b/test/cli/cases/build.default.workspace-nested/build.default.workspace-nested.spec.js @@ -25,46 +25,44 @@ const path = require('path'); const TestBed = require('../../test-bed'); // TODO why does this case need a src/pages/index.md? -describe('Build Greenwood With: ', () => { +describe('Build Greenwood With: ', function() { + const LABEL = 'Default Greenwood Configuration and Default Workspace w/ Nested Directories'; let setup; - let context; - before(async () => { + before(async function() { setup = new TestBed(); - context = setup.setupTestBed(__dirname); + this.context = setup.setupTestBed(__dirname); }); - describe('Default Greenwood Configuration and Default Workspace w/ Nested Directories', () => { - before(async () => { + describe(LABEL, function() { + before(async function() { await setup.runGreenwoodCommand('build'); }); + + runSmokeTest(['public', 'not-found', 'index'], LABEL); - xit('should pass all smoke tests', async () => { - await runSmokeTest(context, setup, 'Default Greenwood Configuration and Default Workspace w/ Nested Directories'); - }); - - it('should create a default blog page directory', () => { - expect(fs.existsSync(path.join(context.publicDir, './blog'))).to.be.true; + it('should create a default blog page directory', function() { + expect(fs.existsSync(path.join(this.context.publicDir, './blog'))).to.be.true; }); - describe('Custom blog page directory', () => { + describe('Custom blog page directory', function() { let dom; - beforeEach(async() => { - dom = await JSDOM.fromFile(path.resolve(context.publicDir, 'blog', '2019', './index.html')); + beforeEach(async function() { + dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'blog', '2019', './index.html')); }); - it('should output an index.html file within the default hello page directory', () => { - expect(fs.existsSync(path.join(context.publicDir, 'blog', '2019', './index.html'))).to.be.true; + it('should output an index.html file within the default hello page directory', function() { + expect(fs.existsSync(path.join(this.context.publicDir, 'blog', '2019', './index.html'))).to.be.true; }); - it('should have the expected heading text within the hello example page in the hello directory', async() => { + it('should have the expected heading text within the hello example page in the hello directory', async function() { const heading = dom.window.document.querySelector('h3').textContent; expect(heading).to.equal('Blog Page'); }); - it('should have the expected paragraph text within the hello example page in the hello directory', async() => { + it('should have the expected paragraph text within the hello example page in the hello directory', async function() { let paragraph = dom.window.document.querySelector('p').textContent; expect(paragraph).to.equal('This is the test blog page built by Greenwood.'); @@ -72,7 +70,7 @@ describe('Build Greenwood With: ', () => { }); }); - after(() => { + after(function() { setup.teardownTestBed(); }); diff --git a/test/cli/cases/build.default.workspace-template-app/build.default.workspace-template-app.spec.js b/test/cli/cases/build.default.workspace-template-app/build.default.workspace-template-app.spec.js index 7ee28b3fb..d155dab2b 100644 --- a/test/cli/cases/build.default.workspace-template-app/build.default.workspace-template-app.spec.js +++ b/test/cli/cases/build.default.workspace-template-app/build.default.workspace-template-app.spec.js @@ -22,45 +22,89 @@ const { JSDOM } = require('jsdom'); const path = require('path'); const TestBed = require('../../test-bed'); -describe('Build Greenwood With: ', () => { +describe('Build Greenwood With: ', function() { + const LABEL = 'Default Greenwood Configuration and Workspace w/Custom App Template'; let setup; - let context; - before(async () => { + before(async function() { setup = new TestBed(); - context = setup.setupTestBed(__dirname); + this.context = setup.setupTestBed(__dirname); }); - describe('Default Greenwood Configuration and Workspace w/Custom App Template', () => { + describe(LABEL, function() { let dom; before(async () => { await setup.runGreenwoodCommand('build'); }); - xit('should pass all smoke tests', async () => { - await runSmokeTest(context, setup, 'Default Greenwood Configuration and Workspace w/Custom App Template'); + runSmokeTest(['public', 'not-found', 'hello'], LABEL); + + describe('Custom Index (Home) page', function() { + const indexPageHeading = 'Greenwood'; + const indexPageBody = 'This is the home page built by Greenwood. Make your own pages in src/pages/index.js!'; + let dom; + + beforeEach(async function() { + dom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'index.html')); + }); + + it('should have a