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

Version Path
appmap-0.72.2 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.72.1 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.72.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.71.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.70.2 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.70.1 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.70.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.69.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.68.2 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.68.1 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.68.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.67.1 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.67.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.66.2 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.66.1 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.66.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.65.1 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.65.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.64.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js
appmap-0.63.0 ./node_modules/@appland/appmap/tests/unit/fingerprint/sql.spec.js