From e9752fec12605684b872eaa9782a58c9e143b83a Mon Sep 17 00:00:00 2001 From: Lucemans Date: Wed, 27 Oct 2021 03:17:13 +0200 Subject: [PATCH] Testing Upgrades --- .eslintignore | 1 + __tests__/createTableRaw.spec.ts | 4 ++-- __tests__/deleteFromRaw.spec.ts | 2 +- __tests__/insertIntoRaw.spec.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..6de2f63 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +*.spec.ts \ No newline at end of file diff --git a/__tests__/createTableRaw.spec.ts b/__tests__/createTableRaw.spec.ts index c14993f..d09d4f3 100644 --- a/__tests__/createTableRaw.spec.ts +++ b/__tests__/createTableRaw.spec.ts @@ -1,9 +1,9 @@ import { createTableRaw } from "../lib"; it('Can create a basic table', async () => { - expect(createTableRaw('scyllo', 'atable', false, {a: {type: 'bigint'}}, 'a')).toEqual({"args": ["a", "bigint", "a"], "query": "CREATE TABLE scyllo.atable (? ?, PRIMARY KEY (?))"}); + expect(createTableRaw<{'atable': {a:string}}, 'atable'>('scyllo', 'atable', false, {a: {type: 'bigint'}}, 'a')).toEqual({"args": ["a", "bigint", "a"], "query": "CREATE TABLE scyllo.atable (? ?, PRIMARY KEY (?))"}); }); it('Can create a basic table if not exists', async () => { - expect(createTableRaw('scyllo', 'atable', true, {a: {type: 'bigint'}}, 'a')).toEqual({"args": ["a", "bigint", "a"], "query": "CREATE TABLE IF NOT EXISTS scyllo.atable (? ?, PRIMARY KEY (?))"}); + expect(createTableRaw<{'atable': {a:string}}, 'atable'>('scyllo', 'atable', true, {a: {type: 'bigint'}}, 'a')).toEqual({"args": ["a", "bigint", "a"], "query": "CREATE TABLE IF NOT EXISTS scyllo.atable (? ?, PRIMARY KEY (?))"}); }); \ No newline at end of file diff --git a/__tests__/deleteFromRaw.spec.ts b/__tests__/deleteFromRaw.spec.ts index 0b1457a..d66789e 100644 --- a/__tests__/deleteFromRaw.spec.ts +++ b/__tests__/deleteFromRaw.spec.ts @@ -1,5 +1,5 @@ import { selectOneFromRaw } from "../lib"; it('Can insert a user into the database', async () => { - expect(selectOneFromRaw('scyllo', 'users', '*', {uid: 1234567890, username: 'Jest'})).toEqual({query: 'SELECT * FROM scyllo.users WHERE uid=? AND username=? LIMIT 1', args: [1234567890, 'Jest']}); + expect(selectOneFromRaw<{'users': {uid: number, username: string}}, 'users'>('scyllo', 'users', '*', {uid: 1234567890, username: 'Jest'})).toEqual({query: 'SELECT * FROM scyllo.users WHERE uid=? AND username=? LIMIT 1', args: [1234567890, 'Jest']}); }); \ No newline at end of file diff --git a/__tests__/insertIntoRaw.spec.ts b/__tests__/insertIntoRaw.spec.ts index 0b1457a..d66789e 100644 --- a/__tests__/insertIntoRaw.spec.ts +++ b/__tests__/insertIntoRaw.spec.ts @@ -1,5 +1,5 @@ import { selectOneFromRaw } from "../lib"; it('Can insert a user into the database', async () => { - expect(selectOneFromRaw('scyllo', 'users', '*', {uid: 1234567890, username: 'Jest'})).toEqual({query: 'SELECT * FROM scyllo.users WHERE uid=? AND username=? LIMIT 1', args: [1234567890, 'Jest']}); + expect(selectOneFromRaw<{'users': {uid: number, username: string}}, 'users'>('scyllo', 'users', '*', {uid: 1234567890, username: 'Jest'})).toEqual({query: 'SELECT * FROM scyllo.users WHERE uid=? AND username=? LIMIT 1', args: [1234567890, 'Jest']}); }); \ No newline at end of file