promptbox/test/promptbox_test.gleam
Isaac e0e2691150
Some checks failed
test / test (push) Has been cancelled
fix formatting
2025-01-21 14:45:42 +11:00

40 lines
751 B
Gleam

import birl
import gleam/io
import gleam/result
import gleeunit
import gleeunit/should
import lustre/element
import promptbox/files
import promptbox/gen
import promptbox/parser
import simplifile
pub fn main() {
gleeunit.main()
}
// gleeunit test functions end in `_test`
pub fn hello_world_test() {
let post =
simplifile.read("./priv/posts/ebb_and_flow.md")
|> result.unwrap("")
|> parser.parse_post
|> io.debug
io.debug(birl.to_date_string(post.date))
files.read_all_posts()
|> io.debug
1
|> should.equal(1)
}
pub fn generate_test() {
let _ = simplifile.create_directory("./dist")
files.read_all_posts()
|> gen.generate_posts
|> element.to_document_string
|> simplifile.write(to: "./dist/index.html")
}