Sha256: 83648bf300a4afd4b68dadea79f0c725255aaa5147bc8ea6a4a17116b1065305
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
const { utimesSync } = require('fs'); const { join } = require('path'); const Depends = require('../../src/depends'); const Fingerprinter = require('../../src/fingerprint/fingerprinter'); const { listAppMapFiles, verbose } = require('../../src/utils'); const appMapDir = join(__dirname, 'fixtures'); const userModelFilePath = join(appMapDir, 'app/models/user.rb'); const now = Date.now(); describe('Depends', () => { beforeAll(async () => { if (process.env.DEBUG) { verbose(true); } const fingerprinter = new Fingerprinter(true); await listAppMapFiles(appMapDir, async (fileName) => { utimesSync(fileName, now, now); await fingerprinter.fingerprint(fileName); }); }); test('indicates when no dependency is modified', async () => { const fn = new Depends(appMapDir); fn.baseDir = join(appMapDir, 'app'); const depends = await fn.depends(); expect(depends).toEqual([]); }); test('indicates when a dependency is modified', async () => { const future = now + 1000; utimesSync(userModelFilePath, future, future); const fn = new Depends(appMapDir); fn.baseDir = appMapDir; const depends = await fn.depends(); expect(depends).toEqual([join(appMapDir, 'user_page_scenario')]); }); test('indicates dependencies in an explicit list', async () => { const fn = new Depends(appMapDir); fn.files = ['app/models/user.rb']; const depends = await fn.depends(); expect(depends).toEqual([join(appMapDir, 'user_page_scenario')]); }); test('AppMaps will be yielded to a callback function', async () => { const result = []; const fn = new Depends(appMapDir); fn.files = ['app/models/user.rb']; await fn.depends((file) => result.push(file)); expect(result).toEqual([join(appMapDir, 'user_page_scenario')]); }); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appmap-0.62.1 | ./node_modules/@appland/cli/tests/unit/depends.spec.js |