MCPcopy
hub / github.com/bitfield/script / TestJQWithFieldQueryProducesSelectedField

Function TestJQWithFieldQueryProducesSelectedField

script_test.go:750–761  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

748}
749
750func TestJQWithFieldQueryProducesSelectedField(t *testing.T) {
751 t.Parallel()
752 input := `{"timestamp": 1649264191, "iss_position": {"longitude": "52.8439", "latitude": "10.8107"}, "message": "success"}`
753 want := `{"latitude":"10.8107","longitude":"52.8439"}` + "\n"
754 got, err := script.Echo(input).JQ(".iss_position").String()
755 if err != nil {
756 t.Fatal(err)
757 }
758 if want != got {
759 t.Error(cmp.Diff(want, got))
760 }
761}
762
763func TestJQWithArrayQueryProducesRequiredArray(t *testing.T) {
764 t.Parallel()

Callers

nothing calls this directly

Calls 4

EchoFunction · 0.92
StringMethod · 0.80
JQMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…