1
0
Fork 0
mirror of synced 2024-09-28 07:11:40 +12:00

Test fixes after running in CI.

This commit is contained in:
mike12345567 2024-03-22 12:36:00 +00:00
parent 5b1db96129
commit 2464020a22

View file

@ -43,7 +43,8 @@ const MYSQL_SPECIFICS = {
} }
const MSSQL_SPECIFICS = { const MSSQL_SPECIFICS = {
nullError: "Cannot convert undefined or null to object", // MS-SQL doesn't throw an error here, it casts empty string to nothing
nullError: undefined,
} }
const MARIADB_SPECIFICS = { const MARIADB_SPECIFICS = {
@ -241,26 +242,31 @@ describe.each([
id: 1, id: 1,
name: "one", name: "one",
birthday: null, birthday: null,
number: null,
}, },
{ {
id: 2, id: 2,
name: "two", name: "two",
birthday: null, birthday: null,
number: null,
}, },
{ {
id: 3, id: 3,
name: "three", name: "three",
birthday: null, birthday: null,
number: null,
}, },
{ {
id: 4, id: 4,
name: "four", name: "four",
birthday: null, birthday: null,
number: null,
}, },
{ {
id: 5, id: 5,
name: "five", name: "five",
birthday: null, birthday: null,
number: null,
}, },
]) ])
}) })
@ -283,6 +289,7 @@ describe.each([
id: 2, id: 2,
name: "one", name: "one",
birthday: null, birthday: null,
number: null,
}, },
]) ])
}) })
@ -311,6 +318,7 @@ describe.each([
id: 1, id: 1,
name: "one", name: "one",
birthday: null, birthday: null,
number: null,
}, },
]) ])
}) })
@ -349,7 +357,9 @@ describe.each([
]) ])
const rows = await rawQuery("SELECT * FROM test_table WHERE id = 1") const rows = await rawQuery("SELECT * FROM test_table WHERE id = 1")
expect(rows).toEqual([{ id: 1, name: "foo", birthday: null }]) expect(rows).toEqual([
{ id: 1, name: "foo", birthday: null, number: null },
])
}) })
it("should be able to execute an update that updates no rows", async () => { it("should be able to execute an update that updates no rows", async () => {
@ -451,8 +461,13 @@ describe.each([
} catch (err: any) { } catch (err: any) {
error = err.message error = err.message
} }
expect(error).toBeDefined() const testExpectation = testSpecificInformation.nullError
expect(error).toContain(testSpecificInformation.nullError) if (testExpectation) {
expect(error).toBeDefined()
expect(error).toContain(testExpectation)
} else {
expect(error).toBeUndefined()
}
}) })
it("should not error for new queries", async () => { it("should not error for new queries", async () => {