Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test

on:
pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened

jobs:
build:
name: Conventional pull request names
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-test:
name: Build & Test
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "go.mod"
- name: Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Build
run: go build ./...
- run: go test -json -v -p 1 ./... | gotestfmt
10 changes: 8 additions & 2 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ func TestJSONPathComplianceTestSuite(t *testing.T) {
// Test case for a valid selector
jp, err := jsonpath.NewPath(test.Selector)
if test.InvalidSelector {
require.Error(t, err, "Expected an error for invalid selector, but got none")
require.Error(t, err, "Expected an error for invalid selector, but got none for path", jp.String())
return
} else {
require.NoError(t, err, "Failed to parse JSONPath selector")
require.NoError(t, err, "Failed to parse JSONPath selector", jp.String())
}

// expect stability of ToString()
stringified := jp.String()
recursive, err := jsonpath.NewPath(stringified)
require.NoError(t, err, "Failed to parse recursive JSONPath selector. expected=%s got=%s", test.Selector, jp.String())
require.Equal(t, stringified, recursive.String(), "JSONPath selector does not match test case")
// interface{} to yaml.Node
toYAML := func(i interface{}) *yaml.Node {
o, err := yaml.Marshal(i)
Expand Down
Loading
Loading