Skip to content

Commit

Permalink
fig generate and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Feb 11, 2024
1 parent c69966f commit 0821653
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
MarkdownLiteral = "736d6165-7244-6769-4267-6b50796e6954"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
PlutoHooks = "0ff47ea0-7a50-410d-8455-4348d5de0774"
PlutoLinks = "0ff47ea0-7a50-410d-8455-4348d5de0420"
Expand All @@ -35,6 +36,7 @@ LiveServer = "1.2"
Logging = "1"
Markdown = "1"
MarkdownLiteral = "0.1"
Pkg = "1"
Pluto = "0.19.38"
PlutoHooks = "0.0.5"
PlutoLinks = "0.1.6"
Expand Down
14 changes: 13 additions & 1 deletion src/PlutoPages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,19 @@ function generate(;
cache_dir::String,
)
app = run_plutopages_notebook(; input_dir, output_dir, cache_dir, run_server=false)
fetch(app.notebook_task)
notebook = fetch(app.notebook_task)

bad = false
for c in notebook.cells
if c.errored
bad = true
@error("Cell errored", c.code, c.output.body)
end
end
if bad
error("Error in notebook")
end

@info "PlutoPages: cleaning up..."
shutdown(app)

Expand Down
22 changes: 21 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,25 @@ using PlutoPages
using Test

@testset "PlutoPages.jl" begin
# Write your tests here.

input_dir = PlutoPages.create_test_basic_site()

dirs = PlutoPages.create_subdirs(input_dir)

result = PlutoPages.generate(; dirs...)
@test result == dirs.output_dir

@info "Done!" dirs readdir(dirs.input_dir) readdir(dirs.output_dir)

@test isdir(dirs.output_dir)
@test isdir(joinpath(dirs.output_dir, "generated_assets"))

@test isfile(joinpath(dirs.output_dir, "index.html"))
@test isfile(joinpath(dirs.output_dir, "htmlpage", "index.html"))
@test isfile(joinpath(dirs.output_dir, "en", "docs", "index.html"))
@test isfile(joinpath(dirs.output_dir, "en", "docs", "packages", "index.html"))
@test isfile(joinpath(dirs.output_dir, "en", "blog", "something", "index.html"))
@test isfile(joinpath(dirs.output_dir, "en", "blog", "yayy", "index.html"))


end

0 comments on commit 0821653

Please sign in to comment.