I am currently conducting a test to verify that the magic number of a Buffer
is in zip
format.
This involves extracting the first 4 bytes of the buffer into a string and comparing it with the magic number for zip, which is PK
.
const zipMagicNumber: string = 'PK'
const uploadedMagicNumber: string = uploadMock.mock.calls[0][0].Body.subarray(0, 4).toString()
expect(zipMagicNumber).toBe(uploadedMagicNumber)
However, the test is failing with the following error:
expect(received).toBe(expected) // Object.is equality
Expected: "PK"
Received: "PK"
Both values are the same and they are both strings. I'm unsure what might be causing this issue. Can anyone help me identify the problem?