Skip to content

Commit

Permalink
Fixed broken tests in awsdataapi tests
Browse files Browse the repository at this point in the history
My previous changes in test file broke a couple tests. I've fixed this now
  • Loading branch information
livingforjesus committed Feb 22, 2024
1 parent c8943fa commit 46bec30
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions integration-tests/tests/awsdatapi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test.serial('select all fields', async (t) => {

t.assert(result[0]!.createdAt instanceof Date); // eslint-disable-line no-instanceof/no-instanceof
// t.assert(Math.abs(result[0]!.createdAt.getTime() - now) < 100);
t.deepEqual(result, [{ id: 1, name: 'John', verified: false, jsonb: null, createdAt: result[0]!.createdAt }]);
t.deepEqual(result, [{ bestTexts: [], id: 1, name: 'John', verified: false, jsonb: null, createdAt: result[0]!.createdAt }]);
});

test.serial('select sql', async (t) => {
Expand Down Expand Up @@ -187,7 +187,7 @@ test.serial('update with returning all fields', async (t) => {

t.assert(users[0]!.createdAt instanceof Date); // eslint-disable-line no-instanceof/no-instanceof
// t.assert(Math.abs(users[0]!.createdAt.getTime() - now) < 100);
t.deepEqual(users, [{ id: 1, name: 'Jane', verified: false, jsonb: null, createdAt: users[0]!.createdAt }]);
t.deepEqual(users, [{ id: 1, bestTexts: [], name: 'Jane', verified: false, jsonb: null, createdAt: users[0]!.createdAt }]);
});

test.serial('update with returning partial', async (t) => {
Expand All @@ -210,7 +210,7 @@ test.serial('delete with returning all fields', async (t) => {

t.assert(users[0]!.createdAt instanceof Date); // eslint-disable-line no-instanceof/no-instanceof
// t.assert(Math.abs(users[0]!.createdAt.getTime() - now) < 100);
t.deepEqual(users, [{ id: 1, name: 'John', verified: false, jsonb: null, createdAt: users[0]!.createdAt }]);
t.deepEqual(users, [{ bestTexts: [], id: 1, name: 'John', verified: false, jsonb: null, createdAt: users[0]!.createdAt }]);
});

test.serial('delete with returning partial', async (t) => {
Expand All @@ -230,13 +230,13 @@ test.serial('insert + select', async (t) => {

await db.insert(usersTable).values({ name: 'John' });
const result = await db.select().from(usersTable);
t.deepEqual(result, [{ id: 1, name: 'John', verified: false, jsonb: null, createdAt: result[0]!.createdAt }]);
t.deepEqual(result, [{ bestTexts: [], id: 1, name: 'John', verified: false, jsonb: null, createdAt: result[0]!.createdAt }]);

await db.insert(usersTable).values({ name: 'Jane' });
const result2 = await db.select().from(usersTable);
t.deepEqual(result2, [
{ id: 1, name: 'John', verified: false, jsonb: null, createdAt: result2[0]!.createdAt },
{ id: 2, name: 'Jane', verified: false, jsonb: null, createdAt: result2[1]!.createdAt },
{ bestTexts: [], id: 1, name: 'John', verified: false, jsonb: null, createdAt: result2[0]!.createdAt },
{ bestTexts: [], id: 2, name: 'Jane', verified: false, jsonb: null, createdAt: result2[1]!.createdAt },
]);
});

Expand Down

0 comments on commit 46bec30

Please sign in to comment.