industry-collection-guard.test.js 711 B

123456789101112131415
  1. import { test } from 'node:test';
  2. import assert from 'node:assert/strict';
  3. import { spawnSync } from 'node:child_process';
  4. test('old paid collection entrypoints stop before loading credentials or a collector', () => {
  5. for (const args of [
  6. ['scripts/collect-review-coverage.cjs', '1'],
  7. ['scripts/collect-product-review-sample.cjs', 'call', 'no-network-test', 'jd', '1', '1'],
  8. ]) {
  9. const result = spawnSync(process.execPath, args, { encoding: 'utf8', windowsHide: true, timeout: 3000 });
  10. assert.equal(result.status, 1);
  11. assert.match(result.stderr, /PAID_COLLECTION_STOPPED/);
  12. assert.doesNotMatch(result.stdout + result.stderr, /MODULE_NOT_FOUND|AUTH_REQUIRED|started.*true/);
  13. }
  14. });