Skip to content

Commit aa92ad0

Browse files
committed
Fixed typo in test files
1 parent b9e02ed commit aa92ad0

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

helper_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ func Test_toFloat64(t *testing.T) {
129129
},
130130
{
131131
val: float32(99.01),
132-
expected: 99.01000213623047, // The nearest IEEE754 float32 value of 99.01 is 99.01000213623047; which are not equal (while using ==). Need suggestions for precesion float value.
133-
// one way to solve the comparison using convertFloat(string with float precesion)==float64
132+
expected: 99.01000213623047, // The nearest IEEE754 float32 value of 99.01 is 99.01000213623047; which are not equal (while using ==). Need suggestions for precision float value.
133+
// one way to solve the comparison using convertFloat(string with float precision)==float64
134134
},
135135
{
136136
val: float32(-99),
@@ -165,25 +165,25 @@ func Test_sorter(t *testing.T) {
165165
outArr []interface{}
166166
}{
167167
{
168-
tag: "list of string, result hould be in ascending order",
168+
tag: "list of string, result should be in ascending order",
169169
asc: true,
170170
inArr: []interface{}{"x", "b", "a", "c", "z"},
171171
outArr: []interface{}{"a", "b", "c", "x", "z"},
172172
},
173173
{
174-
tag: "list of string, result hould be in descending order",
174+
tag: "list of string, result should be in descending order",
175175
asc: false,
176176
inArr: []interface{}{"x", "b", "a", "c", "z"},
177177
outArr: []interface{}{"z", "x", "c", "b", "a"},
178178
},
179179
{
180-
tag: "list of float64, result hould be in ascending order",
180+
tag: "list of float64, result should be in ascending order",
181181
asc: true,
182182
inArr: []interface{}{8.0, 7.0, 1.0, 3.0, 5.0, 8.0},
183183
outArr: []interface{}{1.0, 3.0, 5.0, 7.0, 8.0, 8.0},
184184
},
185185
{
186-
tag: "list of float64, result hould be in descending order",
186+
tag: "list of float64, result should be in descending order",
187187
asc: false,
188188
inArr: []interface{}{8.0, 7.0, 1.0, 3.0, 5.0, 8.0},
189189
outArr: []interface{}{8.0, 8.0, 7.0, 5.0, 3.0, 1.0},

jsonq_test.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestNew(t *testing.T) {
1717

1818
func TestJSONQ_String(t *testing.T) {
1919
jq := New()
20-
expected := fmt.Sprintf("\nContent: %s\nQuries:%v\n", string(jq.raw), jq.queries)
20+
expected := fmt.Sprintf("\nContent: %s\nQueries:%v\n", string(jq.raw), jq.queries)
2121
if out := jq.String(); out != expected {
2222
t.Errorf("Expected: %v\n Got: %v", expected, out)
2323
}
@@ -485,7 +485,7 @@ func TestJSONQ_Sort_string_ascending_order(t *testing.T) {
485485
Sort()
486486
expected := `["Abby","Jane Doe","Jerry","John Doe","Nicolas","Tom"]`
487487
out := jq.Get()
488-
assertJSON(t, out, expected, "sorring array of string in ascending desc")
488+
assertJSON(t, out, expected, "sorting array of string in ascending desc")
489489
}
490490

491491
func TestJSONQ_Sort_float64_descending_order(t *testing.T) {
@@ -494,7 +494,7 @@ func TestJSONQ_Sort_float64_descending_order(t *testing.T) {
494494
Sort("desc")
495495
expected := `[2400,2100,1200,400.87,150.1,89.9]`
496496
out := jq.Get()
497-
assertJSON(t, out, expected, "sorring array of float in descending order")
497+
assertJSON(t, out, expected, "sorting array of float in descending order")
498498
}
499499

500500
func TestJSONQ_Sort_with_two_args_expecting_error(t *testing.T) {
@@ -513,7 +513,7 @@ func TestJSONQ_SortBy_float_ascending_order(t *testing.T) {
513513
SortBy("price")
514514
expected := `[{"id":null,"name":"HP core i3 SSD","price":850},{"id":4,"name":"Fujitsu","price":850},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":6,"name":"HP core i7","price":950},{"id":3,"name":"Sony VAIO","price":1200},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":2,"name":"MacBook Pro 15 inch retina","price":1700}]`
515515
out := jq.Get()
516-
assertJSON(t, out, expected, "sorring array of object by its key (price-float64) in ascending desc")
516+
assertJSON(t, out, expected, "sorting array of object by its key (price-float64) in ascending desc")
517517
}
518518

519519
func TestJSONQ_SortBy_float_descending_order(t *testing.T) {
@@ -522,7 +522,7 @@ func TestJSONQ_SortBy_float_descending_order(t *testing.T) {
522522
SortBy("price", "desc")
523523
expected := `[{"id":2,"name":"MacBook Pro 15 inch retina","price":1700},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":3,"name":"Sony VAIO","price":1200},{"id":6,"name":"HP core i7","price":950},{"id":4,"name":"Fujitsu","price":850},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":null,"name":"HP core i3 SSD","price":850}]`
524524
out := jq.Get()
525-
assertJSON(t, out, expected, "sorring array of object by its key (price-float64) in descending desc")
525+
assertJSON(t, out, expected, "sorting array of object by its key (price-float64) in descending desc")
526526
}
527527

528528
func TestJSONQ_SortBy_string_ascending_order(t *testing.T) {
@@ -531,7 +531,7 @@ func TestJSONQ_SortBy_string_ascending_order(t *testing.T) {
531531
SortBy("name")
532532
expected := `[{"id":4,"name":"Fujitsu","price":850},{"id":null,"name":"HP core i3 SSD","price":850},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":6,"name":"HP core i7","price":950},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":2,"name":"MacBook Pro 15 inch retina","price":1700},{"id":3,"name":"Sony VAIO","price":1200}]`
533533
out := jq.Get()
534-
assertJSON(t, out, expected, "sorring array of object by its key (name-string) in ascending desc")
534+
assertJSON(t, out, expected, "sorting array of object by its key (name-string) in ascending desc")
535535
}
536536

537537
func TestJSONQ_SortBy_string_descending_order(t *testing.T) {
@@ -540,7 +540,7 @@ func TestJSONQ_SortBy_string_descending_order(t *testing.T) {
540540
SortBy("name", "desc")
541541
expected := `[{"id":3,"name":"Sony VAIO","price":1200},{"id":2,"name":"MacBook Pro 15 inch retina","price":1700},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":6,"name":"HP core i7","price":950},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":null,"name":"HP core i3 SSD","price":850},{"id":4,"name":"Fujitsu","price":850}]`
542542
out := jq.Get()
543-
assertJSON(t, out, expected, "sorring array of object by its key (name-string) in descending desc")
543+
assertJSON(t, out, expected, "sorting array of object by its key (name-string) in descending desc")
544544
}
545545

546546
func TestJSONQ_SortBy_no_argument_expecting_error(t *testing.T) {
@@ -717,15 +717,15 @@ func TestJSONQ_Count_expecting_int_from_list(t *testing.T) {
717717
From("vendor.items")
718718
out := jq.Count()
719719
expected := `7`
720-
assertJSON(t, out, expected, "Count expecting a int number of total item of an arry")
720+
assertJSON(t, out, expected, "Count expecting a int number of total item of an array")
721721
}
722722

723723
func TestJSONQ_Count_expecting_int_from_list_of_objects(t *testing.T) {
724724
jq := New().JSONString(jsonStr).
725725
From("vendor.items.[0]")
726726
out := jq.Count()
727727
expected := `3`
728-
assertJSON(t, out, expected, "Count expecting a int number of total item of an arry of objects")
728+
assertJSON(t, out, expected, "Count expecting a int number of total item of an array of objects")
729729
}
730730

731731
func TestJSONQ_Count_expecting_int_from_objects(t *testing.T) {
@@ -734,23 +734,23 @@ func TestJSONQ_Count_expecting_int_from_objects(t *testing.T) {
734734
GroupBy("price")
735735
out := jq.Count()
736736
expected := `5`
737-
assertJSON(t, out, expected, "Count expecting a int number of total item of an arry of groupped objects")
737+
assertJSON(t, out, expected, "Count expecting a int number of total item of an array of grouped objects")
738738
}
739739

740740
func TestJSONQ_Sum_of_array_numeric_values(t *testing.T) {
741741
jq := New().JSONString(jsonStr).
742742
From("vendor.prices")
743743
out := jq.Sum()
744744
expected := `6340.87`
745-
assertJSON(t, out, expected, "Sum expecting sum an arry")
745+
assertJSON(t, out, expected, "Sum expecting sum an array")
746746
}
747747

748748
func TestJSONQ_Sum_of_array_objects_property_numeric_values(t *testing.T) {
749749
jq := New().JSONString(jsonStr).
750750
From("vendor.items")
751751
out := jq.Sum("price")
752752
expected := `7750`
753-
assertJSON(t, out, expected, "Sum expecting sum an arry of objects property")
753+
assertJSON(t, out, expected, "Sum expecting sum an array of objects property")
754754
}
755755

756756
func TestJSONQ_Sum_expecting_error_for_providing_property_of_array(t *testing.T) {
@@ -785,55 +785,55 @@ func TestJSONQ_Sum_expecting_result_from_nested_object(t *testing.T) {
785785
From("vendor.items.[0]")
786786
out := jq.Sum("price")
787787
expected := `1350`
788-
assertJSON(t, out, expected, "Sum expecting resut from nested object")
788+
assertJSON(t, out, expected, "Sum expecting result from nested object")
789789
}
790790

791791
func TestJSONQ_Avg_array(t *testing.T) {
792792
jq := New().JSONString(jsonStr).
793793
From("vendor.prices")
794794
out := jq.Avg()
795795
expected := `1056.8116666666667`
796-
assertJSON(t, out, expected, "Avg expecting average an arry")
796+
assertJSON(t, out, expected, "Avg expecting average an array")
797797
}
798798

799799
func TestJSONQ_Avg_array_of_objects(t *testing.T) {
800800
jq := New().JSONString(jsonStr).
801801
From("vendor.items")
802802
out := jq.Avg("price")
803803
expected := `1107.142857142857`
804-
assertJSON(t, out, expected, "Avg expecting average an arry of objects property")
804+
assertJSON(t, out, expected, "Avg expecting average an array of objects property")
805805
}
806806

807807
func TestJSONQ_Min_array(t *testing.T) {
808808
jq := New().JSONString(jsonStr).
809809
From("vendor.prices")
810810
out := jq.Min()
811811
expected := `89.9`
812-
assertJSON(t, out, expected, "Min expecting min an arry")
812+
assertJSON(t, out, expected, "Min expecting min an array")
813813
}
814814

815815
func TestJSONQ_Min_array_of_objects(t *testing.T) {
816816
jq := New().JSONString(jsonStr).
817817
From("vendor.items")
818818
out := jq.Min("price")
819819
expected := `850`
820-
assertJSON(t, out, expected, "Min expecting min an arry of objects property")
820+
assertJSON(t, out, expected, "Min expecting min an array of objects property")
821821
}
822822

823823
func TestJSONQ_Max_array(t *testing.T) {
824824
jq := New().JSONString(jsonStr).
825825
From("vendor.prices")
826826
out := jq.Max()
827827
expected := `2400`
828-
assertJSON(t, out, expected, "Max expecting max an arry")
828+
assertJSON(t, out, expected, "Max expecting max an array")
829829
}
830830

831831
func TestJSONQ_Max_array_of_objects(t *testing.T) {
832832
jq := New().JSONString(jsonStr).
833833
From("vendor.items")
834834
out := jq.Max("price")
835835
expected := `1700`
836-
assertJSON(t, out, expected, "Max expecting max an arry of objects property")
836+
assertJSON(t, out, expected, "Max expecting max an array of objects property")
837837
}
838838

839839
// TODO: Need to write some more combined query test

query_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func Test_eq(t *testing.T) {
1111
expected bool
1212
}{
1313
{
14-
x: 9.0, // our expectation for json unmarshalar is little bit different. here 9 privided by user will be equal to float64 9
14+
x: 9.0, // our expectation for json unmarshalar is little bit different. here 9 provided by user will be equal to float64 9
1515
y: 9,
1616
expected: true,
1717
},
@@ -67,7 +67,7 @@ func Test_neq(t *testing.T) {
6767
}{
6868
{
6969
x: 9.0, // as x is out json unmarshal value which is float64
70-
y: 9, // our expectation for json unmarshalar is little bit different. here 9 privided by user will be equal to float64 9
70+
y: 9, // our expectation for json unmarshalar is little bit different. here 9 provided by user will be equal to float64 9
7171
expected: false,
7272
},
7373
{

0 commit comments

Comments
 (0)