Skip to content

Commit

Permalink
⚗️ Add test to check encoding and then decoding doesn't modify a Colour.
Browse files Browse the repository at this point in the history
  • Loading branch information
hayleigh-dot-dev committed Mar 23, 2024
1 parent 84b766d commit 38ad15e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/colour.gleam
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gleam/json
import gleeunit/should
import gleam_community/colour

Expand Down Expand Up @@ -202,3 +203,13 @@ pub fn to_rgb_hex_test() {
|> colour.to_rgb_hex()
|> should.equal(0xFFAFF3)
}

pub fn json_identiy_test() {
let assert Ok(c) = colour.from_rgba(r: 1.0, g: 1.0, b: 1.0, a: 1.0)

c
|> colour.encode
|> json.to_string
|> json.decode(colour.decoder)
|> should.equal(Ok(c))
}

0 comments on commit 38ad15e

Please sign in to comment.