test: when calling AVG on an integer column, MS SQL Server returns an 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.
This commit is contained in:
Leon Miller-Out 2023-04-06 02:15:16 -04:00 committed by GitHub
parent f530811b0d
commit 0619aca174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 () => {