Skip to content

Commit

Permalink
test: update events tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Jul 18, 2024
1 parent 8175e1b commit 9227365
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ describe.concurrent('Build', () => {
content: ['test/fixtures/build/**/*.html']
}
},
async afterBuild({ files, config, render }) {
async afterBuild({ files, config, transform }) {
ctx.afterBuild = files
expect(config).toBeInstanceOf(Object)
expect(files).toBeInstanceOf(Array)
expect(render).toBeInstanceOf(Function)
expect(transform.inlineCSS).toBeInstanceOf(Function)
}
}
)
Expand Down
18 changes: 15 additions & 3 deletions test/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ describe.concurrent('Render', () => {

test('Runs the `beforeRender` event', async () => {
const { html } = await render('<div class="inline">{{ page.foo }}</div>', {
beforeRender({ config }) {
beforeRender({ config, posthtml, transform }) {
config.foo = 'bar'

expect(config).toBeInstanceOf(Object)
expect(posthtml).toBeInstanceOf(Function)
expect(transform.inlineCSS).toBeInstanceOf(Function)
}
})

Expand All @@ -36,10 +40,14 @@ describe.concurrent('Render', () => {

test('Runs the `afterRender` event', async () => {
const { html } = await render('<div class="inline">foo</div>', {
afterRender({ config }) {
afterRender({ config, posthtml, transform }) {
config.replaceStrings = {
foo: 'bar'
}

expect(config).toBeInstanceOf(Object)
expect(posthtml).toBeInstanceOf(Function)
expect(transform.inlineCSS).toBeInstanceOf(Function)
}
})

Expand All @@ -51,7 +59,11 @@ describe.concurrent('Render', () => {
replaceStrings: {
foo: 'bar'
},
afterTransformers({ html }) {
afterTransformers({ html, config, posthtml, transform }) {
expect(config).toBeInstanceOf(Object)
expect(posthtml).toBeInstanceOf(Function)
expect(transform.inlineCSS).toBeInstanceOf(Function)

return html.replace('bar', 'baz')
}
})
Expand Down

0 comments on commit 9227365

Please sign in to comment.