Skip to content

Commit

Permalink
snapshot err output should use json val to compare
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Jan 5, 2024
1 parent 8da2971 commit 0a754fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ func (g G) Snapshot(name string, x interface{}) {

if data, ok := g.snapshots.Load(path); ok {
s := data.(snapshot)
if utils.SmartCompare(g.JSON(g.ToJSON(x).Bytes()), s.value) == 0 {
xVal := g.JSON(g.ToJSON(x).Bytes())
if utils.SmartCompare(xVal, s.value) == 0 {
g.snapshots.Store(path, snapshot{x, true})
} else {
g.Assertions.err(AssertionEq, x, s.value)
g.Assertions.err(AssertionEq, xVal, s.value)
}
return
}
Expand Down

0 comments on commit 0a754fa

Please sign in to comment.