Skip to content

Commit

Permalink
revert to using ts-ignore-error
Browse files Browse the repository at this point in the history
  • Loading branch information
qedi-r committed Sep 22, 2024
1 parent 387acee commit a8b3fda
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions packages/loot-core/src/platform/server/sqlite/index.web.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ CREATE TABLE numbers (id TEXT PRIMARY KEY, number INTEGER);
CREATE TABLE textstrings (id TEXT PRIMARY KEY, string TEXT);
`;

interface NumberRowType {
id: string;
number: number;
}

interface StringRowType {
id: string;
string: string;
}

describe('Web sqlite', () => {
it('should rollback transactions', async () => {
const db = await openDatabase();
Expand All @@ -38,7 +28,8 @@ describe('Web sqlite', () => {

let rows = runQuery(db, 'SELECT * FROM numbers', null, true);
expect(rows.length).toBe(1);
expect((rows[0] as NumberRowType).number).toBe(4);
//@ts-expect-error: Property 'number' does not exist on type 'unknown'
expect(rows[0].number).toBe(4);

const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
expect(() => {
Expand All @@ -54,7 +45,8 @@ describe('Web sqlite', () => {
// Nothing should have changed in the db
rows = runQuery(db, 'SELECT * FROM numbers', null, true);
expect(rows.length).toBe(1);
expect((rows[0] as NumberRowType).number).toBe(4);
//@ts-expect-error: Property 'number' does not exist on type 'unknown'
expect(rows[0].number).toBe(4);
});

it('should support nested transactions', async () => {
Expand All @@ -65,7 +57,8 @@ describe('Web sqlite', () => {

let rows = runQuery(db, 'SELECT * FROM numbers', null, true);
expect(rows.length).toBe(1);
expect((rows[0] as NumberRowType).number).toBe(4);
//@ts-expect-error: Property 'number' does not exist on type 'unknown'
expect(rows[0].number).toBe(4);

transaction(db, () => {
runQuery(db, "INSERT INTO numbers (id, number) VALUES ('id2', 5)");
Expand All @@ -86,9 +79,12 @@ describe('Web sqlite', () => {
// Nothing should have changed in the db
rows = runQuery(db, 'SELECT * FROM numbers', null, true);
expect(rows.length).toBe(3);
expect((rows[0] as NumberRowType).number).toBe(4);
expect((rows[1] as NumberRowType).number).toBe(5);
expect((rows[2] as NumberRowType).number).toBe(6);
//@ts-expect-error: Property 'number' does not exist on type 'unknown'
expect(rows[0].number).toBe(4);
//@ts-expect-error: Property 'number' does not exist on type 'unknown'
expect(rows[1].number).toBe(5);
//@ts-expect-error: Property 'number' does not exist on type 'unknown'
expect(rows[2].number).toBe(6);
});

it('should match regex on text fields', async () => {
Expand All @@ -108,6 +104,7 @@ describe('Web sqlite', () => {
true,
);
expect(rows.length).toBe(1);
expect((rows[0] as StringRowType).id).toBe('id1');
//@ts-expect-error: Property 'id' does not exist on type 'unknown'
expect(rows[0].id).toBe('id1');
});
});

0 comments on commit a8b3fda

Please sign in to comment.