open-condo-software / condo

Open source condominium management platform
MIT License
62 stars 26 forks source link

Error when running tests in CI/CD #5009

Closed paulo-rossy closed 1 month ago

paulo-rossy commented 1 month ago

After updating the project to the latest version, some tests started failing. Please take a look at them; I couldn't find any issues on my side.

Errors in GitHub Actions are found in the following tests: ConvertFileToTable.spec.js and InviteNewOrganizationEmployeeService.test.js.

It seems to me that the error in ConvertFileToTable.spec.js is on the OpenCondo side, because this script was added recently. There might be a missing private module:

FAIL packages/keystone/file/ConvertFileToTable.spec.js
  ● ConvertFileToTable › ConvertFileToTable works with file types › it should correctly detect file type › check for check.csv

    Cannot find module '@registry/domains/format/lib/mock-files/check.csv' from 'packages/keystone/file/ConvertFileToTable.spec.js'

      12 |
      13 | const pathToFile = (fileName) => {
    > 14 |     return require.resolve(MOCK_FILES_PATH + fileName)
         |                    ^
      15 | }
      16 |
      17 | describe('ConvertFileToTable', () => {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at resolve (packages/keystone/file/ConvertFileToTable.spec.js:14:20)
      at Object.pathToFile (packages/keystone/file/ConvertFileToTable.spec.js:46:50)

Error from InviteNewOrganizationEmployeeService.test.js:

InviteNewOrganizationEmployeeService › reInviteOrganizationEmployee › called by organization owner › for organization with holding type › should send message with special serverUrl from env (CALLCENTER_DOMAIN)

    expect(received).toHaveProperty(path, value)

    Expected path: ["meta", "serverUrl"]

    Expected value: "http://immaculate-idea.org/"
    Received value: "http://localhost:4002"

      579 |
      580 |                         expect(messages[0].status).toEqual(MESSAGE_SENT_STATUS)
    > 581 |                         expect(messages[0]).toHaveProperty(['meta', 'serverUrl'], conf.CALLCENTER_DOMAIN)
          |                                             ^
      582 |                         expect(messages[0].processingMeta.transportsMeta[0].transport).toEqual(EMAIL_TRANSPORT)
      583 |                         expect(messages[1].status).toEqual(MESSAGE_SENT_STATUS)
      584 |                         expect(messages[1].processingMeta.transportsMeta[0].transport).toEqual(EMAIL_TRANSPORT)

      at toHaveProperty (domains/organization/schema/InviteNewOrganizationEmployeeService.test.js:581:45)
          at runMicrotasks (<anonymous>)
      at Timeout.<anonymous> (../../packages/keystone/test.utils.js:499:32)
SavelevMatthew commented 1 month ago

Hi, thanks for reporting the problems with the tests 🙏


To start InviteNewOrganizationEmployeeService.test.js now you need to put CALLCENTER_DOMAIN in your .env.

We have this done automatically with prepare.js, but I didn't take into account that prepare.js doesn't see all applications when run from the OSS version. I have corrected that in this PR: https://github.com/open-condo-software/condo/pull/5013

Once it gets into the master, you can rerun prepare.js and the tests with InviteNewOrganizationEmployeeService.test.js should run.


The tests from ConvertFileToTable.spec.js are crashing locally because one of our developers moved the tests from the application to packages and didn't move the assets.


We'll fix that too in one of the next PRs, thanks again for the information 🙌

dkoviazin commented 1 month ago

Fixed part for @registry/domains/format/lib/mock-files/check.csv now all mock files are in the same directory (in packages)

pahaz commented 1 month ago

I'll close it for new. If you still have any problem feel free to reopen