qqilihq / evatr

Validate foreign VAT numbers via German “Bundeszentralamt für Steuern”
MIT License
1 stars 2 forks source link

Flaky tests? #31

Open qqilihq opened 5 months ago

qqilihq commented 5 months ago

Is this an API-related error? (seems most probably) But why is there no log output at all?

https://github.com/qqilihq/evatr/actions/runs/9535289834/job/26280828458

qqilihq commented 5 months ago

XML result when running locally node_modules/.bin/nyc --reporter=json ./node_modules/.bin/mocha -R mocha-junit-reporter --reporter-options mochaFile=./testresults.xml

Indeed no console output at all.

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" time="2.670" tests="33" failures="5">
  <testsuite name="Root Suite" timestamp="2024-06-16T10:30:13" tests="0" time="0.000" failures="0">
  </testsuite>
  <testsuite name="evatr VAT validation" timestamp="2024-06-16T10:30:13" tests="1" file="/Users/pk/Developer/evatr/test/index.test.ts" time="0.000" failures="0">
    <testcase name="evatr VAT validation includes raw XML if requested" time="0.780" classname="includes raw XML if requested">
    </testcase>
  </testsuite>
  <testsuite name="simple" timestamp="2024-06-16T10:30:14" tests="9" file="/Users/pk/Developer/evatr/test/index.test.ts" time="0.675" failures="0">
    <testcase name="evatr VAT validation simple returns an object" time="0.001" classname="returns an object">
    </testcase>
    <testcase name="evatr VAT validation simple returns date and time" time="0.000" classname="returns date and time">
    </testcase>
    <testcase name="evatr VAT validation simple returns plausible date and time" time="0.006" classname="returns plausible date and time">
    </testcase>
    <testcase name="evatr VAT validation simple returns code 200" time="0.000" classname="returns code 200">
    </testcase>
    <testcase name="evatr VAT validation simple returns own VAT number" time="0.001" classname="returns own VAT number">
    </testcase>
    <testcase name="evatr VAT validation simple returns validated VAT number" time="0.004" classname="returns validated VAT number">
    </testcase>
    <testcase name="evatr VAT validation simple does not include raw xml" time="0.003" classname="does not include raw xml">
    </testcase>
    <testcase name="evatr VAT validation simple returns readable error description" time="0.000" classname="returns readable error description">
    </testcase>
    <testcase name="evatr VAT validation simple contains valid flag" time="0.000" classname="contains valid flag">
    </testcase>
  </testsuite>
  <testsuite name="qualified" timestamp="2024-06-16T10:30:15" tests="15" file="/Users/pk/Developer/evatr/test/index.test.ts" time="0.320" failures="5">
    <testcase name="evatr VAT validation qualified returns an object" time="0.000" classname="returns an object">
    </testcase>
    <testcase name="evatr VAT validation qualified returns date and time" time="0.001" classname="returns date and time">
    </testcase>
    <testcase name="evatr VAT validation qualified returns plausible date and time" time="0.001" classname="returns plausible date and time">
    </testcase>
    <testcase name="evatr VAT validation qualified returns code 200" time="0.001" classname="returns code 200">
      <failure message="expected 205 to sort of equal 200" type="Error"><![CDATA[Error: expected 205 to sort of equal 200
    at Assertion.assert (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:96:13)
    at Assertion.eql (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:230:10)
    at Context.<anonymous> (/Users/pk/Developer/evatr/test/index.test.ts:88:35)
    at callFn (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:366:21)
    at Test.Runnable.run (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:354:5)
    at Runner.runTest (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:666:10)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:789:12
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:581:14)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:591:7
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:474:14)
    at Immediate._onImmediate (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:476:21)

      + expected - actual

      -205
      +200
      ]]></failure>
    </testcase>
    <testcase name="evatr VAT validation qualified returns own VAT number" time="0.001" classname="returns own VAT number">
    </testcase>
    <testcase name="evatr VAT validation qualified returns validated VAT number" time="0.000" classname="returns validated VAT number">
    </testcase>
    <testcase name="evatr VAT validation qualified returns company name" time="0.000" classname="returns company name">
    </testcase>
    <testcase name="evatr VAT validation qualified returns city" time="0.000" classname="returns city">
    </testcase>
    <testcase name="evatr VAT validation qualified returns zip" time="0.000" classname="returns zip">
    </testcase>
    <testcase name="evatr VAT validation qualified returns street" time="0.000" classname="returns street">
    </testcase>
    <testcase name="evatr VAT validation qualified returns match for name, city, zip, street" time="0.001" classname="returns match for name, city, zip, street">
      <failure message="expected undefined to sort of equal &apos;A&apos;" type="Error"><![CDATA[Error: expected undefined to sort of equal 'A'
    at Assertion.assert (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:96:13)
    at Assertion.eql (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:230:10)
    at Context.<anonymous> (/Users/pk/Developer/evatr/test/index.test.ts:116:36)
    at callFn (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:366:21)
    at Test.Runnable.run (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:354:5)
    at Runner.runTest (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:666:10)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:789:12
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:581:14)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:591:7
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:474:14)
    at Immediate._onImmediate (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:476:21)

      + expected - actual:  failed to generate Mocha diff
]]></failure>
    </testcase>
    <testcase name="evatr VAT validation qualified maps result to German" time="0.001" classname="maps result to German">
      <failure message="expected undefined to sort of equal &apos;stimmt überein&apos;" type="Error"><![CDATA[Error: expected undefined to sort of equal 'stimmt überein'
    at Assertion.assert (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:96:13)
    at Assertion.eql (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:230:10)
    at Context.<anonymous> (/Users/pk/Developer/evatr/test/index.test.ts:123:47)
    at callFn (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:366:21)
    at Test.Runnable.run (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:354:5)
    at Runner.runTest (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:666:10)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:789:12
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:581:14)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:591:7
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:474:14)
    at Immediate._onImmediate (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:476:21)

      + expected - actual:  failed to generate Mocha diff
]]></failure>
    </testcase>
    <testcase name="evatr VAT validation qualified returns empty validFrom and validUntil" time="0.001" classname="returns empty validFrom and validUntil">
    </testcase>
    <testcase name="evatr VAT validation qualified returns readable error description" time="0.000" classname="returns readable error description">
      <failure message="expected &apos;Ihre Anfrage kann derzeit durch den angefragten EU-Mitgliedstaat oder aus anderen Gründen nicht beantwortet werden. Bitte versuchen Sie es später noch einmal. Bei wiederholten Problemen wenden Sie sich bitte an das Bundeszentralamt für Steuern - Dienstsitz Saarlouis.&apos; to sort of equal &apos;Die angefragte USt-IdNr. ist gültig.&apos;" type="Error"><![CDATA[Error: expected 'Ihre Anfrage kann derzeit durch den angefragten EU-Mitgliedstaat oder aus anderen Gründen nicht beantwortet werden. Bitte versuchen Sie es später noch einmal. Bei wiederholten Problemen wenden Sie sich bitte an das Bundeszentralamt für Steuern - Dienstsitz Saarlouis.' to sort of equal 'Die angefragte USt-IdNr. ist gültig.'
    at Assertion.assert (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:96:13)
    at Assertion.eql (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:230:10)
    at Context.<anonymous> (/Users/pk/Developer/evatr/test/index.test.ts:135:42)
    at callFn (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:366:21)
    at Test.Runnable.run (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:354:5)
    at Runner.runTest (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:666:10)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:789:12
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:581:14)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:591:7
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:474:14)
    at Immediate._onImmediate (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:476:21)

      + expected - actual

      -Ihre Anfrage kann derzeit durch den angefragten EU-Mitgliedstaat oder aus anderen Gründen nicht beantwortet werden. Bitte versuchen Sie es später noch einmal. Bei wiederholten Problemen wenden Sie sich bitte an das Bundeszentralamt für Steuern - Dienstsitz Saarlouis.
      +Die angefragte USt-IdNr. ist gültig.
      ]]></failure>
    </testcase>
    <testcase name="evatr VAT validation qualified contains valid flag" time="0.000" classname="contains valid flag">
      <failure message="expected false to sort of equal true" type="Error"><![CDATA[Error: expected false to sort of equal true
    at Assertion.assert (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:96:13)
    at Assertion.eql (/Users/pk/Developer/evatr/node_modules/expect.js/index.js:230:10)
    at Context.<anonymous> (/Users/pk/Developer/evatr/test/index.test.ts:139:31)
    at callFn (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:366:21)
    at Test.Runnable.run (/Users/pk/Developer/evatr/node_modules/mocha/lib/runnable.js:354:5)
    at Runner.runTest (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:666:10)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:789:12
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:581:14)
    at /Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:591:7
    at next (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:474:14)
    at Immediate._onImmediate (/Users/pk/Developer/evatr/node_modules/mocha/lib/runner.js:559:5)
    at processImmediate (node:internal/timers:476:21)

      + expected - actual

      -false
      +true
      ]]></failure>
    </testcase>
  </testsuite>
  <testsuite name="validation" timestamp="2024-06-16T10:30:15" tests="2" file="/Users/pk/Developer/evatr/test/index.test.ts" time="0.598" failures="0">
    <testcase name="evatr VAT validation validation throws error on missing parameter" time="0.001" classname="throws error on missing parameter">
    </testcase>
    <testcase name="evatr VAT validation validation works with empty/missing param" time="0.597" classname="works with empty/missing param">
    </testcase>
  </testsuite>
  <testsuite name="invalid VAT ID" timestamp="2024-06-16T10:30:16" tests="4" file="/Users/pk/Developer/evatr/test/index.test.ts" time="0.285" failures="0">
    <testcase name="evatr VAT validation invalid VAT ID returns an object" time="0.000" classname="returns an object">
    </testcase>
    <testcase name="evatr VAT validation invalid VAT ID returns code 210" time="0.001" classname="returns code 210">
    </testcase>
    <testcase name="evatr VAT validation invalid VAT ID returns readable error description" time="0.000" classname="returns readable error description">
    </testcase>
    <testcase name="evatr VAT validation invalid VAT ID contains valid flag" time="0.001" classname="contains valid flag">
    </testcase>
  </testsuite>
  <testsuite name="parse XML" timestamp="2024-06-16T10:30:16" tests="2" file="/Users/pk/Developer/evatr/test/index.test.ts" time="0.009" failures="0">
    <testcase name="evatr VAT validation parse XML parses simple" time="0.002" classname="parses simple">
    </testcase>
    <testcase name="evatr VAT validation parse XML parses full" time="0.004" classname="parses full">
    </testcase>
  </testsuite>
</testsuites>