-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #167 from mraerino/fix/table-prefixes-in-joins
Fix table prefixes in joins with orders
- Loading branch information
Showing
9 changed files
with
28 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,22 @@ func TestSalesReport(t *testing.T) { | |
assert.Equal(t, uint64(2), row.Orders) | ||
}) | ||
} | ||
|
||
func TestProductsReport(t *testing.T) { | ||
test := NewRouteTest(t) | ||
token := testAdminToken("admin-yo", "[email protected]") | ||
recorder := test.TestEndpoint(http.MethodGet, "/reports/products", nil, token) | ||
|
||
report := []productsRow{} | ||
extractPayload(t, http.StatusOK, recorder, &report) | ||
assert.Len(t, report, 3) | ||
prod1 := report[0] | ||
assert.Equal(t, "234-fancy-belts", prod1.Sku) | ||
assert.Equal(t, uint64(45), prod1.Total) | ||
prod2 := report[1] | ||
assert.Equal(t, "123-i-can-fly-456", prod2.Sku) | ||
assert.Equal(t, uint64(24), prod2.Total) | ||
prod3 := report[2] | ||
assert.Equal(t, "456-i-rollover-all-things", prod3.Sku) | ||
assert.Equal(t, uint64(10), prod3.Total) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters