PhilanthropyDataCommons / service

A project for collecting and serving public information associated with grant applications
GNU Affero General Public License v3.0
8 stars 2 forks source link

Our new auth test sometimes fails #1009

Closed slifty closed 2 months ago

slifty commented 2 months ago

FAIL src/middleware/__tests__/processJwt.int.test.ts
  ● processJwt › does NOT populate an auth value when an auth header with an invalid jwt server is used

    expect(received).toBeInstanceOf(expected)

    Expected constructor: Error

    Received value has no prototype
    Received value: undefined

      90 |      const mockResponse = {} as unknown as Response;
      91 |      const makeAssertions = async (err: unknown) => {
    > 92 |          expect(err).toBeInstanceOf(Error);
         |                      ^
      93 |          expect(mockRequest.auth).toBe(undefined);
      94 |      };
      95 |      const nextMock = generateNextWithAssertions(makeAssertions, done);

      at makeAssertions (src/middleware/__tests__/processJwt.int.test.ts:92:16)
      at src/test/utils.ts:21:3
      at Immediate.wrappedNext (src/middleware/processJwt.ts:14:10)

Test Suites: 1 failed, 27 passed, 28 total
Tests:       1 failed, 222 passed, 223 total
Snapshots:   0 total
Time:        44.632 s

Not sure why this happens yet / it is inconsistent. Seems to happen more on github CI.

reefdog commented 2 months ago

I saw it locally on my machine.