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