Skip to content

Removed should.eql#26432

Merged
EvanHahn merged 2 commits intomainfrom
should.eql-begone
Feb 16, 2026
Merged

Removed should.eql#26432
EvanHahn merged 2 commits intomainfrom
should.eql-begone

Conversation

@EvanHahn
Copy link
Contributor

This test-only change should have no user impact.

This replaces should.eql with assert.equal and assert.deepEqual.

This replaces `should.eql` with `assert.equal` and `assert.deepEqual`.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This pull request replaces Should.js assertion calls with Node.js assert APIs across many test files (unit, integration, e2e, legacy). Examples include converting .should.eql() to assert.equal() and .should.deepEqual() to assert.deepEqual() or assert.deepStrictEqual() where applicable. No production code, exported/public signatures, or test control flow logic are modified; changes are limited to test assertion syntax and expected-value comparisons.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Removed should.eql' is concise, specific, and accurately describes the main change—replacing should.eql assertions with assert.equal/deepEqual across test files.
Description check ✅ Passed The description clearly states this is a test-only change replacing should.eql with assert.equal and assert.deepEqual, which directly relates to the changeset.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch should.eql-begone

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ghost/core/test/unit/server/services/email-analytics/email-analytics-service.test.js (1)

874-874: ⚠️ Potential issue | 🟡 Minor

Missed should-style assertions on lines 874 and 890.

These two lines still use should.be.true and were not converted as part of this migration:

service.queries.aggregateEmailStats.calledWith('memberId').should.be.true;
service.queries.aggregateMemberStats.calledWith('memberId').should.be.true;
Proposed fix
-            service.queries.aggregateEmailStats.calledWith('memberId').should.be.true;
+            assert.equal(service.queries.aggregateEmailStats.calledWith('memberId'), true);
-            service.queries.aggregateMemberStats.calledWith('memberId').should.be.true;
+            assert.equal(service.queries.aggregateMemberStats.calledWith('memberId'), true);

Also applies to: 890-890

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@ghost/core/test/unit/server/services/email-analytics/email-analytics-service.test.js`
at line 874, Two assertions still use the old should-style chaining; update them
to use expect() assertions: replace the expression on
service.queries.aggregateEmailStats (calledWith('memberId')) and the one on
service.queries.aggregateMemberStats (calledWith('memberId')) with
expect(service.queries.aggregateEmailStats.calledWith('memberId')).to.be.true
and
expect(service.queries.aggregateMemberStats.calledWith('memberId')).to.be.true
respectively so the tests use the migrated expect-style assertions.
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.


In `@ghost/core/test/integration/importer/v2.test.js`:
- Around line 688-689: The two identical assertions comparing users[1].slug to
exportData.data.users[0].slug are duplicated; update one of them in the test
file (v2.test.js) so it validates a different user property (for example replace
the second duplicate assertion with an assertion that users[1].email equals
exportData.data.users[0].email or users[1].name equals
exportData.data.users[0].name) to ensure the test checks both slug and another
distinct field; locate the assertions by the symbols users and
exportData.data.users in the test and change the second assert.equal
accordingly.

In `@ghost/core/test/legacy/api/admin/redirects.test.js`:
- Line 2: The file imports the legacy assertion library via "const should =
require('should');" but there are no should-style assertions used in
redirects.test.js; remove this unused import to clean up the test file (delete
the require('should') line where "should" is declared) and run tests to ensure
no code path depends on the "should" symbol.

In `@ghost/core/test/legacy/api/admin/schedules.test.js`:
- Line 4: Remove the unused `should` import in the test file by deleting the
`const should = require('should');` statement in
ghost/core/test/legacy/api/admin/schedules.test.js (the `should` identifier and
its require call are not used anywhere in this file); after removal run the test
suite to ensure no implicit dependency on `should` remains.

In `@ghost/core/test/legacy/api/content/posts.test.js`:
- Line 3: The test file imports the legacy assertion library via the const
should = require('should'); statement but no `should`-style assertions remain,
so remove the unused import to clean up the file; locate the top-level `should`
require statement and delete it (or replace with a needed assertion import if
tests require one), then run the test suite to verify no references to the
`should` variable remain.

In `@ghost/core/test/unit/api/canary/utils/serializers/output/mapper.test.js`:
- Line 229: The test currently uses assert.equal(mapped, newsletter.toJSON())
which checks reference equality instead of deep structural equality; update the
assertion in the test (the line using assert.equal with mapped and
newsletter.toJSON()) to use assert.deepEqual so the mapper result is compared
deeply to newsletter.toJSON() preserving the original should.eql semantics.

In `@ghost/core/test/unit/server/adapters/scheduling/scheduling-default.test.js`:
- Line 2: Remove the unused CommonJS import "should" (the require('should')
statement) from the test file since there are no should-style assertions left;
locate the top-level require('should') expression in scheduling-default.test.js
and delete it, then run the test suite to confirm there are no remaining
references to the symbol.

In `@ghost/core/test/unit/server/data/exporter/index.test.js`:
- Around line 54-55: The test has inconsistent assertion styles: one assertion
uses assert.equal while adjacent assertions still use the older should.have.eql
form (e.g., queryMock.select.callCount.should.have.eql(expectedCallCount) and
the occurrences around the second block flagged). Replace those should.have.eql
usages with the same assert.equal form (or assert.strictEqual if preferred) to
match the converted assertion style; specifically update assertions that
reference queryMock.select.callCount and any other callCount checks in the same
test to use assert.equal(queryMock.select.callCount, expectedCallCount) (or
assert.strictEqual) so all assertions are consistent.

In
`@ghost/core/test/unit/server/services/email-analytics/email-analytics-service.test.js`:
- Line 874: Two assertions still use the old should-style chaining; update them
to use expect() assertions: replace the expression on
service.queries.aggregateEmailStats (calledWith('memberId')) and the one on
service.queries.aggregateMemberStats (calledWith('memberId')) with
expect(service.queries.aggregateEmailStats.calledWith('memberId')).to.be.true
and
expect(service.queries.aggregateMemberStats.calledWith('memberId')).to.be.true
respectively so the tests use the migrated expect-style assertions.

In `@ghost/core/test/unit/server/services/verification-trigger.test.js`:
- Line 5: Remove the now-unused require('should') import from the top of the
verification-trigger.test.js file: delete the standalone require('should')
statement so no dead/unused assertion library is imported; ensure no other code
relies on "should" style assertions in this test (e.g., any should.* calls)
before removing.

In `@ghost/core/test/unit/shared/config/loader.test.js`:
- Line 2: Remove the unused "should" import from the test file: delete the line
that requires 'should' (the const should = require('should'); at the top of
ghost/core/test/unit/shared/config/loader.test.js) since there are no
should-style assertions remaining; run tests to ensure nothing else relied on
that import and commit the cleaned file.
🧹 Nitpick comments (7)
🤖 Fix all nitpicks with AI agents
Verify each finding against the current code and only fix it if needed.


In `@ghost/core/test/legacy/api/admin/redirects.test.js`:
- Line 2: The file imports the legacy assertion library via "const should =
require('should');" but there are no should-style assertions used in
redirects.test.js; remove this unused import to clean up the test file (delete
the require('should') line where "should" is declared) and run tests to ensure
no code path depends on the "should" symbol.

In `@ghost/core/test/legacy/api/admin/schedules.test.js`:
- Line 4: Remove the unused `should` import in the test file by deleting the
`const should = require('should');` statement in
ghost/core/test/legacy/api/admin/schedules.test.js (the `should` identifier and
its require call are not used anywhere in this file); after removal run the test
suite to ensure no implicit dependency on `should` remains.

In `@ghost/core/test/legacy/api/content/posts.test.js`:
- Line 3: The test file imports the legacy assertion library via the const
should = require('should'); statement but no `should`-style assertions remain,
so remove the unused import to clean up the file; locate the top-level `should`
require statement and delete it (or replace with a needed assertion import if
tests require one), then run the test suite to verify no references to the
`should` variable remain.

In `@ghost/core/test/unit/server/adapters/scheduling/scheduling-default.test.js`:
- Line 2: Remove the unused CommonJS import "should" (the require('should')
statement) from the test file since there are no should-style assertions left;
locate the top-level require('should') expression in scheduling-default.test.js
and delete it, then run the test suite to confirm there are no remaining
references to the symbol.

In `@ghost/core/test/unit/server/data/exporter/index.test.js`:
- Around line 54-55: The test has inconsistent assertion styles: one assertion
uses assert.equal while adjacent assertions still use the older should.have.eql
form (e.g., queryMock.select.callCount.should.have.eql(expectedCallCount) and
the occurrences around the second block flagged). Replace those should.have.eql
usages with the same assert.equal form (or assert.strictEqual if preferred) to
match the converted assertion style; specifically update assertions that
reference queryMock.select.callCount and any other callCount checks in the same
test to use assert.equal(queryMock.select.callCount, expectedCallCount) (or
assert.strictEqual) so all assertions are consistent.

In `@ghost/core/test/unit/server/services/verification-trigger.test.js`:
- Line 5: Remove the now-unused require('should') import from the top of the
verification-trigger.test.js file: delete the standalone require('should')
statement so no dead/unused assertion library is imported; ensure no other code
relies on "should" style assertions in this test (e.g., any should.* calls)
before removing.

In `@ghost/core/test/unit/shared/config/loader.test.js`:
- Line 2: Remove the unused "should" import from the test file: delete the line
that requires 'should' (the const should = require('should'); at the top of
ghost/core/test/unit/shared/config/loader.test.js) since there are no
should-style assertions remaining; run tests to ensure nothing else relied on
that import and commit the cleaned file.
ghost/core/test/unit/shared/config/loader.test.js (1)

2-2: Unused should import can be removed.

No remaining should-style assertions in this file.

Proposed fix
-const should = require('should');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/unit/shared/config/loader.test.js` at line 2, Remove the
unused "should" import from the test file: delete the line that requires
'should' (the const should = require('should'); at the top of
ghost/core/test/unit/shared/config/loader.test.js) since there are no
should-style assertions remaining; run tests to ensure nothing else relied on
that import and commit the cleaned file.
ghost/core/test/legacy/api/content/posts.test.js (1)

3-3: Unused should import can be removed.

No remaining should-style assertions in this file.

Proposed fix
-const should = require('should');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/legacy/api/content/posts.test.js` at line 3, The test file
imports the legacy assertion library via the const should = require('should');
statement but no `should`-style assertions remain, so remove the unused import
to clean up the file; locate the top-level `should` require statement and delete
it (or replace with a needed assertion import if tests require one), then run
the test suite to verify no references to the `should` variable remain.
ghost/core/test/unit/server/services/verification-trigger.test.js (1)

5-5: Unused should import can be removed.

No remaining should-style assertions in this file. The require('should') on line 5 is now dead code.

Proposed fix
-require('should');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/unit/server/services/verification-trigger.test.js` at line 5,
Remove the now-unused require('should') import from the top of the
verification-trigger.test.js file: delete the standalone require('should')
statement so no dead/unused assertion library is imported; ensure no other code
relies on "should" style assertions in this test (e.g., any should.* calls)
before removing.
ghost/core/test/unit/server/adapters/scheduling/scheduling-default.test.js (1)

2-2: Unused should import can be removed.

No remaining should-style assertions in this file.

Proposed fix
-const should = require('should');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/unit/server/adapters/scheduling/scheduling-default.test.js`
at line 2, Remove the unused CommonJS import "should" (the require('should')
statement) from the test file since there are no should-style assertions left;
locate the top-level require('should') expression in scheduling-default.test.js
and delete it, then run the test suite to confirm there are no remaining
references to the symbol.
ghost/core/test/unit/server/data/exporter/index.test.js (1)

54-55: Inconsistent migration: adjacent line still uses should.have.eql.

Line 54 was converted to assert.equal, but line 55 (queryMock.select.callCount.should.have.eql(expectedCallCount)) uses the same pattern and was left unconverted. Same applies to lines 101–102.

Proposed fix
-                queryMock.select.callCount.should.have.eql(expectedCallCount);
+                assert.equal(queryMock.select.callCount, expectedCallCount);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/unit/server/data/exporter/index.test.js` around lines 54 -
55, The test has inconsistent assertion styles: one assertion uses assert.equal
while adjacent assertions still use the older should.have.eql form (e.g.,
queryMock.select.callCount.should.have.eql(expectedCallCount) and the
occurrences around the second block flagged). Replace those should.have.eql
usages with the same assert.equal form (or assert.strictEqual if preferred) to
match the converted assertion style; specifically update assertions that
reference queryMock.select.callCount and any other callCount checks in the same
test to use assert.equal(queryMock.select.callCount, expectedCallCount) (or
assert.strictEqual) so all assertions are consistent.
ghost/core/test/legacy/api/admin/redirects.test.js (1)

2-2: should import appears unused.

No remaining should-style assertions are visible in this file. Consider removing this import.

Proposed fix
-const should = require('should');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/legacy/api/admin/redirects.test.js` at line 2, The file
imports the legacy assertion library via "const should = require('should');" but
there are no should-style assertions used in redirects.test.js; remove this
unused import to clean up the test file (delete the require('should') line where
"should" is declared) and run tests to ensure no code path depends on the
"should" symbol.
ghost/core/test/legacy/api/admin/schedules.test.js (1)

4-4: should import appears unused.

No remaining should-style assertions are visible in this file. Consider removing this import.

Proposed fix
-const should = require('should');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/legacy/api/admin/schedules.test.js` at line 4, Remove the
unused `should` import in the test file by deleting the `const should =
require('should');` statement in
ghost/core/test/legacy/api/admin/schedules.test.js (the `should` identifier and
its require call are not used anywhere in this file); after removal run the test
suite to ensure no implicit dependency on `should` remains.

Comment on lines +688 to +689
assert.equal(users[1].slug, exportData.data.users[0].slug);
assert.equal(users[1].slug, exportData.data.users[0].slug);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate assertion: lines 688 and 689 are identical.

Both lines assert the same thing (users[1].slug === exportData.data.users[0].slug). This is likely a pre-existing copy-paste issue, but one of these should probably verify a different property (e.g., email or name).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/integration/importer/v2.test.js` around lines 688 - 689, The
two identical assertions comparing users[1].slug to
exportData.data.users[0].slug are duplicated; update one of them in the test
file (v2.test.js) so it validates a different user property (for example replace
the second duplicate assertion with an assertion that users[1].email equals
exportData.data.users[0].email or users[1].name equals
exportData.data.users[0].name) to ensure the test checks both slug and another
distinct field; locate the assertions by the symbols users and
exportData.data.users in the test and change the second assert.equal
accordingly.

…r.test.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@EvanHahn EvanHahn enabled auto-merge (squash) February 16, 2026 23:23
@EvanHahn EvanHahn merged commit ca2f01c into main Feb 16, 2026
33 checks passed
@EvanHahn EvanHahn deleted the should.eql-begone branch February 16, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant