Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed unit test #9

Closed
peterdesmet opened this issue Apr 5, 2023 · 3 comments
Closed

Failed unit test #9

peterdesmet opened this issue Apr 5, 2023 · 3 comments

Comments

@peterdesmet
Copy link
Member

Merging the changes from #8 broke one unit test:

/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:103
      obj[headers[j].trim()] = data[j].trim();
                     ^

TypeError: Cannot read properties of undefined (reading 'trim')
    at csvStringToObjs (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:107:25)
    at parseCSVVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:123:13)
    at Object.parseVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:186:12)
    at /Users/peter_desmet/Coding/Repositories/enram/crow/src/components/Home.vue:454:110
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v19.8.1
ts-jest[versions] (WARN) Version 4.9.5 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:103
      obj[headers[j].trim()] = data[j].trim();
                     ^

TypeError: Cannot read properties of undefined (reading 'trim')
    at csvStringToObjs (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:107:25)
    at parseCSVVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:123:13)
    at Object.parseVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:186:12)
    at /Users/peter_desmet/Coding/Repositories/enram/crow/src/components/Home.vue:454:110
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v19.8.1
ts-jest[versions] (WARN) Version 4.9.5 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:103
      obj[headers[j].trim()] = data[j].trim();
                     ^

TypeError: Cannot read properties of undefined (reading 'trim')
    at csvStringToObjs (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:107:25)
    at parseCSVVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:123:13)
    at Object.parseVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:186:12)
    at /Users/peter_desmet/Coding/Repositories/enram/crow/src/components/Home.vue:454:110
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v19.8.1
ts-jest[versions] (WARN) Version 4.9.5 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:103
      obj[headers[j].trim()] = data[j].trim();
                     ^

TypeError: Cannot read properties of undefined (reading 'trim')
    at csvStringToObjs (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:107:25)
    at parseCSVVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:123:13)
    at Object.parseVpts (/Users/peter_desmet/Coding/Repositories/enram/crow/src/helpers.ts:186:12)
    at /Users/peter_desmet/Coding/Repositories/enram/crow/src/components/Home.vue:454:110
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v19.8.1
 FAIL  tests/unit/crow.spec.ts
  ● Test suite failed to run

    Call retries were exceeded

      at ChildProcessWorker.initialize (node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)

Test Suites: 1 failed, 2 passed, 3 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        7.235s
Ran all test suites.

Ping @niconoe

@niconoe
Copy link

niconoe commented Apr 6, 2023

Will investigate right now!

@niconoe
Copy link

niconoe commented Apr 6, 2023

This is due to the fact that the some tests mock the radar data:

jest.spyOn(axios, 'get').mockResolvedValue(
{"data": fs.readFileSync(path.resolve(__dirname, "./data/behel_vpts_20200129.truncated.txt"), "utf-8")})

but not the actual configuration, so production config is used. Since in this fork, the behel radar is configured in the CSV format, the Home component actually gets data in the VOL2BIRD format but try to interpret it as CSV.

I was not able to just quickly overwrite configuration in the test files, since this config is loaded at a later stage by the Vue components via VueX config store.

The proper way to solve this is to mock the config file / config store for the tests, so they are not dependent anymore of the specific install configuration, which should be done in upstream (INBO) CROW.

@peterdesmet
Copy link
Member Author

Thanks! We have inbo#192 to fix that more generally, for now it is fine to comment out those tests (for enram/crow only) as you have done in #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants