Skip to content

Commit

Permalink
Add more snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdeviant committed May 14, 2024
1 parent ff0f23a commit 0157db8
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 18 deletions.
11 changes: 11 additions & 0 deletions birdie_snapshots/expect_to_be_error_given_an_ok.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_be_error given an Ok
---
Expected Ok(Nil) to be Error

- Expected
+ Received

- Error(_)
+ Ok(Nil)
11 changes: 11 additions & 0 deletions birdie_snapshots/expect_to_be_false_given_true.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_be_false given True
---
Expected True to equal False

- Expected
+ Received

- False
+ True
11 changes: 11 additions & 0 deletions birdie_snapshots/expect_to_be_none_given_a_some.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_be_none given a Some
---
Expected Some(Nil) to be None

- Expected
+ Received

- None
+ Some(Nil)
11 changes: 11 additions & 0 deletions birdie_snapshots/expect_to_be_ok_given_an_error.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_be_ok given an Error
---
Expected Error(Nil) to be Ok

- Expected
+ Received

- Ok(_)
+ Error(Nil)
11 changes: 11 additions & 0 deletions birdie_snapshots/expect_to_be_some_given_a_none.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_be_some given a None
---
Expected None to be Some

- Expected
+ Received

- Some(_)
+ None
11 changes: 11 additions & 0 deletions birdie_snapshots/expect_to_be_true_given_false.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_be_true given False
---
Expected False to equal True

- Expected
+ Received

- True
+ False
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_equal with two different integers
---
Expected 2 to equal 4

- Expected
+ Received

- 4
+ 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 1.1.5
title: expect/to_not_equal with two equal integers
---
Expected 3 to not equal 3

- Expected
+ Received

- 3
+ 3
38 changes: 20 additions & 18 deletions test/startest/expect_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ pub fn to_equal_tests() {
}),
]),
describe("given two different integers", [
it_fails(fn() {
2
|> expect.to_equal(4)
}),
it_fails_matching_snapshot(
"expect/to_equal with two different integers",
fn() {
2
|> expect.to_equal(4)
},
),
]),
]),
])
Expand All @@ -32,10 +35,13 @@ pub fn to_not_equal_tests() {
}),
]),
describe("given two equal integers", [
it_fails(fn() {
3
|> expect.to_not_equal(3)
}),
it_fails_matching_snapshot(
"expect/to_not_equal with two equal integers",
fn() {
3
|> expect.to_not_equal(3)
},
),
]),
]),
])
Expand All @@ -51,7 +57,7 @@ pub fn to_be_true_tests() {
}),
]),
describe("given False", [
it_fails(fn() {
it_fails_matching_snapshot("expect/to_be_true given False", fn() {
False
|> expect.to_be_true
}),
Expand All @@ -70,7 +76,7 @@ pub fn to_be_false_tests() {
}),
]),
describe("given True", [
it_fails(fn() {
it_fails_matching_snapshot("expect/to_be_false given True", fn() {
True
|> expect.to_be_false
}),
Expand All @@ -89,7 +95,7 @@ pub fn to_be_ok_tests() {
}),
]),
describe("given an Error", [
it_fails(fn() {
it_fails_matching_snapshot("expect/to_be_ok given an Error", fn() {
Error(Nil)
|> expect.to_be_ok
}),
Expand All @@ -108,7 +114,7 @@ pub fn to_be_error_tests() {
}),
]),
describe("given an Ok", [
it_fails(fn() {
it_fails_matching_snapshot("expect/to_be_error given an Ok", fn() {
Ok(Nil)
|> expect.to_be_error
}),
Expand All @@ -127,7 +133,7 @@ pub fn to_be_some_tests() {
}),
]),
describe("given a None", [
it_fails(fn() {
it_fails_matching_snapshot("expect/to_be_some given a None", fn() {
None
|> expect.to_be_some
}),
Expand All @@ -146,7 +152,7 @@ pub fn to_be_none_tests() {
}),
]),
describe("given a Some", [
it_fails(fn() {
it_fails_matching_snapshot("expect/to_be_none given a Some", fn() {
Some(Nil)
|> expect.to_be_none
}),
Expand Down Expand Up @@ -203,10 +209,6 @@ pub fn to_loosely_equal_tests() {
}),
]),
describe("given two loosely inequal floats", [
it_fails(fn() {
2.0
|> expect.to_loosely_equal(2.4, tolerating: 0.1)
}),
it_fails_matching_snapshot("expect/to_loosely_equal", fn() {
2.0
|> expect.to_loosely_equal(2.4, tolerating: 0.1)
Expand Down

0 comments on commit 0157db8

Please sign in to comment.