-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.spec.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (?))"}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']}); | ||
}); |