Sha256: 08f18bde6b34ea9c245a05d60b000591744aa49e0ea2327d24e7006f9cfd24e7

Contents?: true

Size: 1.29 KB

Versions: 20

Compression:

Stored size: 1.29 KB

Contents

/* eslint-disable no-restricted-syntax */
const { buildAppMap } = require('@appland/models');
const { readFileSync, writeFileSync } = require('fs-extra');
const {
  algorithms,
  canonicalize,
} = require('../../../src/fingerprint/canonicalize');
const apiKeyScenario = require('../fixtures/ruby/revoke_api_key.appmap.json');

const apiKeyAppMap = buildAppMap().source(apiKeyScenario).normalize().build();

const doUpdateFixtures = () => process.env.UPDATE_FIXTURES === 'true';

describe('Canonicalize', () => {
  test('lists available algorithms', () => {
    expect(Object.keys(algorithms)).toContain('trace');
  });

  ['update', 'info', 'trace'].forEach((algorithmName) => {
    test(`${algorithmName.toUpperCase()} level`, async () => {
      const normalForm = await canonicalize(algorithmName, apiKeyAppMap);

      const updateFixtureFile = () => {
        writeFileSync(
          `tests/unit/fixtures/ruby/canonicalize/revoke_api_key.${algorithmName}.json`,
          JSON.stringify(normalForm, null, 2)
        );
      };

      if (doUpdateFixtures()) {
        updateFixtureFile();
      }
      expect(
        JSON.parse(
          readFileSync(
            `tests/unit/fixtures/ruby/canonicalize/revoke_api_key.${algorithmName}.json`
          )
        )
      ).toEqual(normalForm);
    });
  });
});

Version data entries

20 entries across 20 versions & 1 rubygems

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