Sha256: 985f4b89a900f1824fcc0badce87cd698d85f2265cbd3d0049ebb449bb5cd4c2
Contents?: true
Size: 1.05 KB
Versions: 21
Compression:
Stored size: 1.05 KB
Contents
const { normalizeSQL } = require('@appland/models'); describe('Normalize SQL', () => { test('Simple SELECT', () => { const sql = 'SELECT * FROM users'; const result = normalizeSQL(sql); expect(result).toEqual({ actions: ['select'], columns: ['*'], tables: ['users'], }); }); test('Simple INSERT', () => { const sql = `INSERT INTO users (login) VALUES ('fred')`; const result = normalizeSQL(sql); expect(result).toEqual({ actions: ['insert'], columns: ['login'], tables: ['users'], }); }); test('INSERT RETURNING', () => { const sql = `INSERT INTO users (login) VALUES ('fred') RETURNING *`; const result = normalizeSQL(sql); expect(result).toEqual({ actions: ['insert'], columns: ['login'], tables: ['users'], }); }); test('Simple UPDATE', () => { const sql = `UPDATE users SET login = 'fred'`; const result = normalizeSQL(sql); expect(result).toEqual({ actions: ['update'], columns: ['login'], tables: ['users'], }); }); });
Version data entries
21 entries across 21 versions & 1 rubygems