Skip to content

Commit

Permalink
chore: Move hello world to its own user_story
Browse files Browse the repository at this point in the history
  • Loading branch information
Olian04 committed Jun 14, 2024
1 parent c60f3b7 commit a12fdb6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 46 deletions.
46 changes: 0 additions & 46 deletions test/handles_test.gleam
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
import gleam/dict
import gleam/dynamic
import gleam/io
import gleam/list
import gleeunit
import gleeunit/should
import handles

pub fn main() {
gleeunit.main()
}

pub fn handles_hello_world_test() {
handles.prepare("Hello {{name}}")
|> should.be_ok
|> handles.run(
dict.new()
|> dict.insert("name", "Oliver")
|> dynamic.from,
)
|> should.be_ok
|> should.equal("Hello Oliver")
}

pub fn handles_loop_test() {
handles.prepare("{{#each knattarna}}Hello {{name}}\n{{/each}}")
|> should.be_ok
|> io.debug
|> handles.run(
dict.new()
|> dict.insert(
"knattarna",
list.new()
|> list.append([
dict.new()
|> dict.insert("name", "Knatte")
|> dynamic.from,
dict.new()
|> dict.insert("name", "Fnatte")
|> dynamic.from,
dict.new()
|> dict.insert("name", "Tjatte")
|> dynamic.from,
])
|> dynamic.from,
)
|> dynamic.from,
)
|> should.be_ok
|> should.equal("Hello Knatte\nHello Fnatte\nHello Tjatte\n")
}
17 changes: 17 additions & 0 deletions test/user_stories/helloworld_test.gleam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import gleam/dict
import gleam/dynamic
import gleeunit/should
import handles

pub fn handles_hello_world_test() {
handles.prepare("Hello {{name}}")
|> should.be_ok
|> handles.run(
dict.new()
|> dict.insert("name", "Oliver")
|> dynamic.from,
)
|> should.be_ok
|> should.equal("Hello Oliver")
}

0 comments on commit a12fdb6

Please sign in to comment.