Sha256: 428c0323fcf0cd4b8d3966f2c454b99ba2427d318622e422ba4aecb3e3f53b96
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 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/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/canonicalize/revoke_api_key.${algorithmName}.json`, JSON.stringify(normalForm, null, 2) ); }; if (doUpdateFixtures()) { updateFixtureFile(); } expect( JSON.parse( readFileSync( `tests/unit/fixtures/canonicalize/revoke_api_key.${algorithmName}.json` ) ) ).toEqual(normalForm); }); }); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appmap-0.62.1 | ./node_modules/@appland/cli/tests/unit/fingerprint/canonicalize.spec.js |