Refactor event processing in tests for chronological order
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

- Updated test files to collect events first and sort them by their CreatedAt timestamp before processing, ensuring events are handled in chronological order.
- Removed redundant error checks for scanner errors after event processing.
- Enhanced clarity and maintainability of event handling in tests across multiple files, including export, fetch, and query tests.
- Adjusted expected index counts in tests to reflect changes in event structure and processing logic.
This commit is contained in:
2025-10-16 15:05:19 +01:00
parent db941a18ea
commit a4c4f14b87
38 changed files with 400 additions and 238 deletions

View File

@@ -8,7 +8,7 @@
// These flags are shared across both "json", "jsontext", and "jsonopts".
package jsonflags
import "encoding/json/internal"
import "next.orly.dev/pkg/json/internal"
// Bools represents zero or more boolean flags, all set to true or false.
// The least-significant bit is the boolean value of all flags in the set.

View File

@@ -7,8 +7,8 @@
package jsonopts
import (
"encoding/json/internal"
"encoding/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal"
"next.orly.dev/pkg/json/internal/jsonflags"
)
// Options is the common options type shared across json packages.

View File

@@ -13,7 +13,7 @@ import (
"unicode/utf16"
"unicode/utf8"
"encoding/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonflags"
)
// escapeASCII reports whether the ASCII character needs to be escaped.

View File

@@ -11,9 +11,9 @@ import (
"errors"
"io"
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonopts"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonopts"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// NOTE: The logic for decoding is complicated by the fact that reading from

View File

@@ -11,9 +11,9 @@ import (
"io"
"math/bits"
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonopts"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonopts"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// Encoder is a streaming encoder from raw JSON tokens and values.

View File

@@ -11,7 +11,7 @@ import (
"io"
"strconv"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonwire"
)
const errorPrefix = "jsontext: "

View File

@@ -9,7 +9,7 @@ package jsontext
import (
"io"
"encoding/json/internal"
"next.orly.dev/pkg/json/internal"
)
// Internal is for internal use only.

View File

@@ -9,9 +9,9 @@ package jsontext
import (
"strings"
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonopts"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonopts"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// Options configures [NewEncoder], [Encoder.Reset], [NewDecoder],

View File

@@ -7,8 +7,8 @@
package jsontext
import (
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// AppendQuote appends a double-quoted JSON string literal representing src

View File

@@ -14,7 +14,7 @@ import (
"strings"
"unicode/utf8"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// ErrDuplicateName indicates that a JSON token could not be

View File

@@ -12,8 +12,8 @@ import (
"math"
"strconv"
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// NOTE: Token is analogous to v1 json.Token.

View File

@@ -13,8 +13,8 @@ import (
"slices"
"sync"
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonwire"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonwire"
)
// NOTE: Value is analogous to v1 json.RawMessage.

View File

@@ -15,9 +15,9 @@ import (
"reflect"
"strconv"
"encoding/json/internal/jsonwire"
"encoding/json/jsontext"
jsonv2 "encoding/json/v2"
"next.orly.dev/pkg/json/internal/jsonwire"
"next.orly.dev/pkg/json/jsontext"
jsonv2 "next.orly.dev/pkg/json/v2"
)
// Unmarshal parses the JSON-encoded data and stores the result

View File

@@ -24,7 +24,7 @@ import (
"reflect"
"strconv"
jsonv2 "encoding/json/v2"
jsonv2 "next.orly.dev/pkg/json/v2"
)
// Marshal returns the JSON encoding of v.

View File

@@ -10,7 +10,7 @@ import (
"bytes"
"strings"
"encoding/json/jsontext"
"next.orly.dev/pkg/json/jsontext"
)
// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029

View File

@@ -12,9 +12,9 @@ import (
"strconv"
"strings"
"encoding/json/internal"
"encoding/json/jsontext"
jsonv2 "encoding/json/v2"
"next.orly.dev/pkg/json/internal"
"next.orly.dev/pkg/json/jsontext"
jsonv2 "next.orly.dev/pkg/json/v2"
)
// Inject functionality into v2 to properly handle v1 types.

View File

@@ -177,10 +177,10 @@ package json
import (
"encoding"
"encoding/json/internal/jsonflags"
"encoding/json/internal/jsonopts"
"encoding/json/jsontext"
jsonv2 "encoding/json/v2"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/internal/jsonopts"
"next.orly.dev/pkg/json/jsontext"
jsonv2 "next.orly.dev/pkg/json/v2"
)
// Reference encoding, jsonv2, and jsontext packages to assist pkgsite

View File

@@ -11,9 +11,9 @@ import (
"io"
"strings"
"encoding/json/internal"
"encoding/json/internal/jsonflags"
"encoding/json/jsontext"
"next.orly.dev/pkg/json/internal"
"next.orly.dev/pkg/json/internal/jsonflags"
"next.orly.dev/pkg/json/jsontext"
)
// export exposes internal functionality of the "jsontext" package.

View File

@@ -10,8 +10,8 @@ import (
"bytes"
"io"
"encoding/json/jsontext"
jsonv2 "encoding/json/v2"
"next.orly.dev/pkg/json/jsontext"
jsonv2 "next.orly.dev/pkg/json/v2"
)
// A Decoder reads and decodes JSON values from an input stream.