Failing test: Tests > Get Authors of the Pad
File: src/tests/backend/specs/api/pad.ts:282-288
Status on develop HEAD (b96e262): failing — reproducible locally with the standard test command.
What the test does
it('Get Authors of the Pad', async function () {
const res = await agent.get(`${endPoint('listAuthorsOfPad')}?padID=${testPadId}`)
.set("Authorization", (await common.generateJWTToken()))
.expect(200);
assert.equal(res.body.data.authorIDs.length, 0);
});
The assertion expects the pad to have zero authors after the earlier setHTML calls in the same describe block.
What happens
res.body.data.authorIDs.length === 1. The author list contains one entry — listAuthorsOfPad is finding an attributed author the test setup didn't intend.
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
1 !== 0
Why this is likely a test bug, not a code bug
setHTML is called earlier in the suite. The HTML import path attributes the inserted content to some author (either the JWT subject, an internal default, or the system author depending on the code path). The presence of one author in the pool is consistent with that behaviour; the test's expectation of zero authors is what's stale.
Suggested fixes (choose one)
- Update the assertion to
assert.equal(res.body.data.authorIDs.length, 1) and (optionally) assert that the single entry matches the expected author identifier.
- Or, if zero-author behaviour is intentionally desired for the API surface, change
listAuthorsOfPad to filter out internal/system authors.
Reproduction
NODE_ENV=production npx mocha --import=tsx --require ./tests/backend/diagnostics.ts \
--timeout 60000 tests/backend/specs/api/pad.ts
Failing test:
Tests > Get Authors of the PadFile:
src/tests/backend/specs/api/pad.ts:282-288Status on develop HEAD (b96e262): failing — reproducible locally with the standard test command.
What the test does
The assertion expects the pad to have zero authors after the earlier setHTML calls in the same
describeblock.What happens
res.body.data.authorIDs.length === 1. The author list contains one entry —listAuthorsOfPadis finding an attributed author the test setup didn't intend.Why this is likely a test bug, not a code bug
setHTMLis called earlier in the suite. The HTML import path attributes the inserted content to some author (either the JWT subject, an internal default, or the system author depending on the code path). The presence of one author in the pool is consistent with that behaviour; the test's expectation of zero authors is what's stale.Suggested fixes (choose one)
assert.equal(res.body.data.authorIDs.length, 1)and (optionally) assert that the single entry matches the expected author identifier.listAuthorsOfPadto filter out internal/system authors.Reproduction
NODE_ENV=production npx mocha --import=tsx --require ./tests/backend/diagnostics.ts \ --timeout 60000 tests/backend/specs/api/pad.ts