Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions test-cases/default-layout/index.test.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { test } from 'node:test'
import assert from 'node:assert'
import { DomStack } from '../../index.js'
import { testBuild } from '../../index.js'
import * as path from 'path'
import { rm } from 'fs/promises'

const __dirname = import.meta.dirname

test.describe('default-layout', () => {
test('should build site with default layout', async () => {
test('should build site with default layout', async (t) => {
const src = path.join(__dirname, './src')
const dest = path.join(__dirname, './public')
const siteUp = new DomStack(src, dest)
const build = await testBuild(src)

await rm(dest, { recursive: true, force: true })
t.after(async () => {
await build.cleanup()
})

await siteUp.build()

assert.ok(true, 'built with default layout')
assert.ok(build.results, 'built with default layout')
})
})
15 changes: 8 additions & 7 deletions test-cases/drafts/index.test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { test } from 'node:test'
import assert from 'node:assert'
import { DomStack } from '../../index.js'
import { testBuild } from '../../index.js'
import * as path from 'path'
import { rm, stat, readFile } from 'fs/promises'
import { stat, readFile } from 'fs/promises'
import * as cheerio from 'cheerio'
import { allFiles } from 'async-folder-walker'

const __dirname = import.meta.dirname

test.describe('drafts', () => {
test('should build site with draft pages', async () => {
test('should build site with draft pages', async (t) => {
const src = path.join(__dirname, './src')
const dest = path.join(__dirname, './public')
const siteUp = new DomStack(src, dest, { buildDrafts: true })
const build = await testBuild(src, { buildDrafts: true })
const { dest, results } = build

await rm(dest, { recursive: true, force: true })
t.after(async () => {
await build.cleanup()
})

const results = await siteUp.build()
assert.ok(results, 'Domstack built site and returned build results')

const pages = {
Expand Down
13 changes: 7 additions & 6 deletions test-cases/general-features/index.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test } from 'node:test'
import assert from 'node:assert'
import { DomStack } from '../../index.js'
import { testBuild } from '../../index.js'
import * as path from 'path'
import { rm, stat, readFile } from 'fs/promises'
import { stat, readFile } from 'fs/promises'
import * as cheerio from 'cheerio'
import { allFiles } from 'async-folder-walker'

Expand All @@ -11,12 +11,13 @@ const __dirname = import.meta.dirname
test.describe('general-features', () => {
test('should build site with all features', async (t) => {
const src = path.join(__dirname, './src')
const dest = path.join(__dirname, './public')
const siteUp = new DomStack(src, dest, { copy: [path.join(__dirname, './copyfolder')] })
const build = await testBuild(src, { copy: [path.join(__dirname, './copyfolder')] })
const { dest, results } = build

await rm(dest, { recursive: true, force: true })
t.after(async () => {
await build.cleanup()
})

const results = await siteUp.build()
assert.ok(results, 'DomStack built site and returned build results')

const globalAssets = {
Expand Down