Skip to content

[DRAFT] Restrict upload status changes #287

[DRAFT] Restrict upload status changes

[DRAFT] Restrict upload status changes #287

GitHub Actions / jest-github-action failed Nov 28, 2023 in 0s

Jest tests failed

Failed tests: 4/464. Failed suites: 4/103.

Details

  ● sampleFileController › patchFile works correctly

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: "sampleId", "features10x", "uploaded"
    Received: undefined, "uploaded"

    Number of calls: 1

      179 |     expect(SampleFile).toHaveBeenCalled();
      180 |
    > 181 |     expect(sampleFileInstance.updateUploadStatus).toHaveBeenCalledWith('sampleId', 'features10x', uploadStatus);
          |                                                   ^
      182 |
      183 |     // Response is generated signed url
      184 |     expect(mockRes.json).toHaveBeenCalledWith(OK());

      at Object.<anonymous> (tests/api.v2/controllers/sampleFileController.test.js:181:51)

  ● tests for experiment route › Patching a file upload status results in a successful response

    expected 200 "OK", got 405 "Method Not Allowed"

      at Test.Object.<anonymous>.Test._assertStatus (node_modules/supertest/lib/test.js:268:12)
      at Test.Object.<anonymous>.Test._assertFunction (node_modules/supertest/lib/test.js:283:11)
      at Test.Object.<anonymous>.Test.assert (node_modules/supertest/lib/test.js:173:18)
      at Server.localAssert (node_modules/supertest/lib/test.js:131:12)

  ● tests for experiment route › Patching a file upload status fails if body is invalid

    expected 400 "Bad Request", got 405 "Method Not Allowed"

      at Test.Object.<anonymous>.Test._assertStatus (node_modules/supertest/lib/test.js:268:12)
      at Test.Object.<anonymous>.Test._assertFunction (node_modules/supertest/lib/test.js:283:11)
      at Test.Object.<anonymous>.Test.assert (node_modules/supertest/lib/test.js:173:18)
      at Server.localAssert (node_modules/supertest/lib/test.js:131:12)

  ● model/Sample › updateUploadStatus works correctly if valid params are passed

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    - Expected
    + Received

      Object {
    -   "upload_status": "fileNotFound",
    +   "upload_status": "features10x",
      },

    Number of calls: 1

      61 |
      62 |     expect(mockSqlClient).toHaveBeenCalledWith({ sf: tableNames.SAMPLE_FILE });
    > 63 |     expect(mockSqlClient.update).toHaveBeenCalledWith({ upload_status: mockUploadStatus });
         |                                  ^
      64 |     expect(mockSqlClient.whereExists).toHaveBeenCalled();
      65 |
      66 |     expect(mockSqlClient).toHaveBeenCalledWith({ sf_map: tableNames.SAMPLE_TO_SAMPLE_FILE_MAP });

      at Object.<anonymous> (tests/api.v2/model/SampleFile.test.js:63:34)

Annotations

Check failure on line 164 in tests/api.v2/controllers/sampleFileController.test.js

See this annotation in the file changed.

@github-actions github-actions / jest-github-action

sampleFileController > patchFile works correctly

Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: "sampleId", "features10x", "uploaded"
Received: undefined, "uploaded"

Number of calls: 1
    at Object.<anonymous> (/home/runner/work/api/api/tests/api.v2/controllers/sampleFileController.test.js:181:51)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Check failure on line 94 in tests/api.v2/routes/sampleFile.test.js

See this annotation in the file changed.

@github-actions github-actions / jest-github-action

tests for experiment route > Patching a file upload status results in a successful response

Error: expected 200 "OK", got 405 "Method Not Allowed"
    at Test.Object.<anonymous>.Test._assertStatus (/home/runner/work/api/api/node_modules/supertest/lib/test.js:268:12)
    at Test.Object.<anonymous>.Test._assertFunction (/home/runner/work/api/api/node_modules/supertest/lib/test.js:283:11)
    at Test.Object.<anonymous>.Test.assert (/home/runner/work/api/api/node_modules/supertest/lib/test.js:173:18)
    at Server.localAssert (/home/runner/work/api/api/node_modules/supertest/lib/test.js:131:12)
    at Object.onceWrapper (events.js:519:28)
    at Server.emit (events.js:400:28)
    at Server.emit (domain.js:475:12)
    at emitCloseNT (net.js:1677:8)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)

Check failure on line 122 in tests/api.v2/routes/sampleFile.test.js

See this annotation in the file changed.

@github-actions github-actions / jest-github-action

tests for experiment route > Patching a file upload status fails if body is invalid

Error: expected 400 "Bad Request", got 405 "Method Not Allowed"
    at Test.Object.<anonymous>.Test._assertStatus (/home/runner/work/api/api/node_modules/supertest/lib/test.js:268:12)
    at Test.Object.<anonymous>.Test._assertFunction (/home/runner/work/api/api/node_modules/supertest/lib/test.js:283:11)
    at Test.Object.<anonymous>.Test.assert (/home/runner/work/api/api/node_modules/supertest/lib/test.js:173:18)
    at Server.localAssert (/home/runner/work/api/api/node_modules/supertest/lib/test.js:131:12)
    at Object.onceWrapper (events.js:519:28)
    at Server.emit (events.js:400:28)
    at Server.emit (domain.js:475:12)
    at emitCloseNT (net.js:1677:8)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)

Check failure on line 54 in tests/api.v2/model/SampleFile.test.js

See this annotation in the file changed.

@github-actions github-actions / jest-github-action

model/Sample > updateUploadStatus works correctly if valid params are passed

Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

- Expected
+ Received

  Object {
-   "upload_status": "fileNotFound",
+   "upload_status": "features10x",
  },

Number of calls: 1
    at Object.<anonymous> (/home/runner/work/api/api/tests/api.v2/model/SampleFile.test.js:63:34)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)