Skip to content

Commit

Permalink
test: when calling AVG on an integer column, MS SQL Server returns an…
Browse files Browse the repository at this point in the history
… int. (#9784)

In this case, 50 instead of 50.5. Apparently the ANSI standard for SQL
is silent on this issue, so either behavior should be considered
acceptable.
  • Loading branch information
sbleon authored Apr 6, 2023
1 parent f530811 commit 0619aca
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ describe("repository > aggregate methods", () => {
describe("average", () => {
it("should return the aggregate average", async () => {
const average = await repository.average("counter")
expect(average).to.equal(50.5)
// Some RDBMSs (e.g. SQL Server) will return an int when averaging an int column, so either
// answer is acceptable.
expect([50, 50.5]).to.include(average)
})

it("should return null when 0 rows match the query", async () => {
Expand Down

0 comments on commit 0619aca

Please sign in to comment.