background-verification-flow-module.test.js 649 B

1234567891011121314151617
  1. const test = require('node:test');
  2. const assert = require('node:assert/strict');
  3. const fs = require('node:fs');
  4. test('background imports verification flow module', () => {
  5. const source = fs.readFileSync('background.js', 'utf8');
  6. assert.match(source, /background\/verification-flow\.js/);
  7. });
  8. test('verification flow module exposes a factory', () => {
  9. const source = fs.readFileSync('background/verification-flow.js', 'utf8');
  10. const globalScope = {};
  11. const api = new Function('self', `${source}; return self.MultiPageBackgroundVerificationFlow;`)(globalScope);
  12. assert.equal(typeof api?.createVerificationFlowHelpers, 'function');
  13. });