Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
67 changes: 0 additions & 67 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion __fixtures__/kitchen-sink/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { skitch } from './src/cli';
var argv = require('minimist')(process.argv.slice(2));
const argv = require('minimist')(process.argv.slice(2));

// skitch upgrade
(async () => {
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/kitchen-sink/typescript.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { skitch } from './src/cli';
var argv = require('minimist')(process.argv.slice(2));
const argv = require('minimist')(process.argv.slice(2));

// skitch upgrade
(async () => {
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/output/schemas/actions_public.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UUID, Timestamp } from "./_common";
import { Timestamp,UUID } from "./_common";
export interface ast_actions {
id: number;
database_id: UUID;
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/output/schemas/collections_public.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UUID, Timestamp } from "./_common";
import { Timestamp,UUID } from "./_common";
export interface check_constraint {
id: UUID;
database_id: UUID;
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/output/schemas/db_migrate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UUID, Timestamp } from "./_common";
import { Timestamp,UUID } from "./_common";
export interface migrate_files {
id: UUID;
database_id: UUID | null;
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/output/schemas/objects_private.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UUID, Timestamp } from "./_common";
import { Timestamp,UUID } from "./_common";
export interface object {
id: UUID;
database_id: UUID;
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/output/schemas/txs_public.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UUID, Timestamp } from "./_common";
import { Timestamp,UUID } from "./_common";
export interface commit {
id: UUID;
message: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ it('newbie', async () => {
'accept_privacy',
...repeat('complete_action', 3)
];

for (const name of steps) {
await pg.any(
`INSERT INTO status_public.user_steps (user_id, name) VALUES ($1, $2)`,
Expand All @@ -76,24 +77,28 @@ it('newbie', async () => {
`SELECT * FROM status_public.steps_required($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advancedRequirements })).toMatchSnapshot();

const newbieRequirements = await pg.any(
`SELECT * FROM status_public.steps_required($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbieRequirements })).toMatchSnapshot();

const [userAchievedNewbie] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbie: userAchievedNewbie })).toMatchSnapshot();

const [userAchievedAdvanced] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advanced: userAchievedAdvanced })).toMatchSnapshot();
});

Expand All @@ -106,6 +111,7 @@ it('advanced', async () => {
...repeat('invite_users', 3),
...repeat('complete_action', 21)
];

for (const name of steps) {
await pg.any(
`INSERT INTO status_public.user_steps (user_id, name) VALUES ($1, $2)`,
Expand All @@ -117,24 +123,28 @@ it('advanced', async () => {
`SELECT * FROM status_public.steps_required($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advancedRequirements })).toMatchSnapshot();

const newbieRequirements = await pg.any(
`SELECT * FROM status_public.steps_required($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbieRequirements })).toMatchSnapshot();

const [userAchievedNewbie] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbie: userAchievedNewbie })).toMatchSnapshot();

const [userAchievedAdvanced] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advanced: userAchievedAdvanced })).toMatchSnapshot();
});

Expand All @@ -157,6 +167,7 @@ it('advanced part II', async () => {
...repeat('invite_users', 3),
...repeat('complete_action', 10)
];

for (const name of steps) {
await pg.any(
`INSERT INTO status_public.user_steps (user_id, name) VALUES ($1, $2)`,
Expand All @@ -168,24 +179,28 @@ it('advanced part II', async () => {
`SELECT * FROM status_public.steps_required($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advancedRequirements })).toMatchSnapshot();

const newbieRequirements = await pg.any(
`SELECT * FROM status_public.steps_required($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbieRequirements })).toMatchSnapshot();

const [userAchievedNewbie] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbie: userAchievedNewbie })).toMatchSnapshot();

const [userAchievedAdvanced] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advanced: userAchievedAdvanced })).toMatchSnapshot();
});

Expand Down Expand Up @@ -227,23 +242,27 @@ it('advanced part III', async () => {
`SELECT * FROM status_public.steps_required($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advancedRequirements })).toMatchSnapshot();

const newbieRequirements = await pg.any(
`SELECT * FROM status_public.steps_required($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbieRequirements })).toMatchSnapshot();

const [userAchievedNewbie] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['newbie', user_id]
);

expect(snapshot({ newbie: userAchievedNewbie })).toMatchSnapshot();

const [userAchievedAdvanced] = await pg.any(
`SELECT * FROM status_public.user_achieved($1, $2)`,
['advanced', user_id]
);

expect(snapshot({ advanced: userAchievedAdvanced })).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ it('newbie', async () => {
const beforeInsert = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ beforeInsert })).toMatchSnapshot();

await pg.any(
Expand All @@ -127,40 +128,46 @@ it('newbie', async () => {
const afterFirstInsert = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ afterFirstInsert })).toMatchSnapshot();

await pg.any(`UPDATE status_public.mytable SET toggle = 'yo'`);

const afterUpdateToggleToValue = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ afterUpdateToggleToValue })).toMatchSnapshot();

await pg.any(`UPDATE status_public.mytable SET toggle = NULL`);

const afterUpdateToggleToNull = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ afterUpdateToggleToNull })).toMatchSnapshot();

await pg.any(`UPDATE status_public.mytable SET is_verified = TRUE`);

const afterIsVerifiedIsTrue = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ afterIsVerifiedIsTrue })).toMatchSnapshot();

await pg.any(`UPDATE status_public.mytable SET is_verified = FALSE`);

const afterIsVerifiedIsFalse = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ afterIsVerifiedIsFalse })).toMatchSnapshot();

await pg.any(`UPDATE status_public.mytable SET is_approved = TRUE`);

const afterIsApprovedTrue = await pg.any(
`SELECT * FROM status_public.user_achievements ORDER BY name`
);

expect(snapshot({ afterIsApprovedTrue })).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getConnections, PgTestClient } from 'pgsql-test';
import cases from 'jest-in-case';
import { getConnections, PgTestClient } from 'pgsql-test';

let pg: PgTestClient;
let teardown: () => Promise<void>;
Expand All @@ -18,6 +18,7 @@ it('base32_to_decimal', async () => {
`SELECT base32.base32_to_decimal($1::text) AS base32_to_decimal`,
['INQXI===']
);

expect(base32_to_decimal).toEqual(['8', '13', '16', '23', '8', '=', '=', '=']);
});

Expand All @@ -26,6 +27,7 @@ it('decimal_to_chunks', async () => {
`SELECT base32.decimal_to_chunks($1::text[]) AS decimal_to_chunks`,
[['8', '13', '16', '23', '8', '=', '=', '=']]
);

expect(decimal_to_chunks).toEqual([
'01000',
'01101',
Expand All @@ -43,6 +45,7 @@ it('decode', async () => {
`SELECT base32.decode($1::text) AS decode`,
['INQXI']
);

expect(decode).toEqual('Cat');
});

Expand All @@ -51,6 +54,7 @@ it('zero_fill', async () => {
`SELECT base32.zero_fill($1::int, $2::int) AS zero_fill`,
[300, 2]
);

expect(zero_fill).toBe('75');
});

Expand All @@ -59,6 +63,7 @@ it('zero_fill (-)', async () => {
`SELECT base32.zero_fill($1::int, $2::int) AS zero_fill`,
[-300, 2]
);

expect(zero_fill).toBe('1073741749');
});

Expand All @@ -67,6 +72,7 @@ it('zero_fill (0)', async () => {
`SELECT base32.zero_fill($1::int, $2::int) AS zero_fill`,
[-300, 0]
);

expect(zero_fill).toBe('4294966996');
});

Expand All @@ -77,6 +83,7 @@ cases(
`SELECT base32.decode($1::text) AS decode`,
[opts.name]
);

expect(decode).toEqual(opts.result);
expect(decode).toMatchSnapshot();
},
Expand Down
Loading
Loading