Skip to content

Commit

Permalink
Testing Upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Oct 27, 2021
1 parent 96158ad commit e9752fe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.spec.ts
4 changes: 2 additions & 2 deletions __tests__/createTableRaw.spec.ts
Original file line number Diff line number Diff line change
@@ -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 (?))"});
});
2 changes: 1 addition & 1 deletion __tests__/deleteFromRaw.spec.ts
Original file line number Diff line number Diff line change
@@ -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']});
});
2 changes: 1 addition & 1 deletion __tests__/insertIntoRaw.spec.ts
Original file line number Diff line number Diff line change
@@ -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']});
});

0 comments on commit e9752fe

Please sign in to comment.