• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ory / x / 13912274386

18 Mar 2025 12:01AM UTC coverage: 61.082% (-1.2%) from 62.237%
13912274386

push

github

web-flow
chore: bump and reduce dependencies (#845)

- bump a bunch of dependencies
- move dev dependencies to `go tools`
- add go.mod for non-consumable module

35 of 42 new or added lines in 6 files covered. (83.33%)

179 existing lines in 21 files now uncovered.

7088 of 11604 relevant lines covered (61.08%)

0.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.92
/assertx/assertx.go
1
// Copyright © 2023 Ory Corp
2
// SPDX-License-Identifier: Apache-2.0
3

4
package assertx
5

6
import (
7
        "bytes"
8
        "encoding/json"
9
        "math"
10
        "strings"
11
        "testing"
12
        "time"
13

14
        "github.com/tidwall/sjson"
15

16
        "github.com/stretchr/testify/assert"
17
        "github.com/stretchr/testify/require"
18
)
19

20
func PrettifyJSONPayload(t testing.TB, payload interface{}) string {
1✔
21
        t.Helper()
1✔
22
        o, err := json.MarshalIndent(payload, "", "  ")
1✔
23
        require.NoError(t, err)
1✔
24
        return string(o)
1✔
25
}
1✔
26

UNCOV
27
func EqualAsJSON(t testing.TB, expected, actual interface{}, args ...interface{}) {
×
UNCOV
28
        t.Helper()
×
UNCOV
29
        var eb, ab bytes.Buffer
×
UNCOV
30
        if len(args) == 0 {
×
UNCOV
31
                args = []interface{}{PrettifyJSONPayload(t, actual)}
×
UNCOV
32
        }
×
33

UNCOV
34
        require.NoError(t, json.NewEncoder(&eb).Encode(expected), args...)
×
UNCOV
35
        require.NoError(t, json.NewEncoder(&ab).Encode(actual), args...)
×
UNCOV
36
        assert.JSONEq(t, strings.TrimSpace(eb.String()), strings.TrimSpace(ab.String()), args...)
×
37
}
38

39
func EqualAsJSONExcept(t testing.TB, expected, actual interface{}, except []string, args ...interface{}) {
1✔
40
        t.Helper()
1✔
41
        var eb, ab bytes.Buffer
1✔
42
        if len(args) == 0 {
2✔
43
                args = []interface{}{PrettifyJSONPayload(t, actual)}
1✔
44
        }
1✔
45

46
        require.NoError(t, json.NewEncoder(&eb).Encode(expected), args...)
1✔
47
        require.NoError(t, json.NewEncoder(&ab).Encode(actual), args...)
1✔
48

1✔
49
        var err error
1✔
50
        ebs, abs := eb.String(), ab.String()
1✔
51
        for _, k := range except {
2✔
52
                ebs, err = sjson.Delete(ebs, k)
1✔
53
                require.NoError(t, err)
1✔
54

1✔
55
                abs, err = sjson.Delete(abs, k)
1✔
56
                require.NoError(t, err)
1✔
57
        }
1✔
58

59
        assert.JSONEq(t, strings.TrimSpace(ebs), strings.TrimSpace(abs), args...)
1✔
60
}
61

62
func TimeDifferenceLess(t testing.TB, t1, t2 time.Time, seconds int) {
1✔
63
        t.Helper()
1✔
64
        delta := math.Abs(float64(t1.Unix()) - float64(t2.Unix()))
1✔
65
        assert.Less(t, delta, float64(seconds))
1✔
66
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc