From 0619aca174801d8a443f499b96af155f778e7a74 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Thu, 6 Apr 2023 02:15:16 -0400 Subject: [PATCH] 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. --- .../aggregate-methods/repository-aggregate-methods.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/functional/repository/aggregate-methods/repository-aggregate-methods.ts b/test/functional/repository/aggregate-methods/repository-aggregate-methods.ts index 89049475cc..c65fee589d 100644 --- a/test/functional/repository/aggregate-methods/repository-aggregate-methods.ts +++ b/test/functional/repository/aggregate-methods/repository-aggregate-methods.ts @@ -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 () => {