-
Notifications
You must be signed in to change notification settings - Fork 922
Add tests for the addition of cached data in the dashboard frontend package #22216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pull Request Test Coverage Report for Build 91b9a4994deeba5f197c52928f328466f14ced00Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR 🏗️
P.S. your PR is still in draft.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some branches are not covered.
I can recommend running coverage and checking out the report for details.
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---|---|---|---|---|---|
cache.js | 90 | 66.67 | 100 | 90 | 59,69,200-208 |
Code coverage report for src_services_cache.js (5_6_2025 11:07:40 AM).html.zip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brought branch coverage to 80% with this commit. I've tried to mock the storage API functions, to increase it even more to no avail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an example of getting to test the exception for an error when the storage is exceeded:
it( "should return the storage also when quota exceeded", () => {
global.FakeStorage = {
setItem: jest.fn().mockImplementation( () => {
throw new DOMException( "code 22", "QuotaExceededError" );
} ),
removeItem: jest.fn(),
length: 1,
};
setStorageOrder( [ "FakeStorage" ] );
try {
expect( getStorage() ).toEqual( global.FakeStorage );
expect( global.FakeStorage.setItem ).toHaveBeenCalled();
} finally {
// Clean up the fake storage.
delete global.FakeStorage;
}
} );
Not sure how far you actually want/need to go. But if it is because you didn't know how, this should help.
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Outdated
Show resolved
Hide resolved
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Show resolved
Hide resolved
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Outdated
Show resolved
Hide resolved
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Show resolved
Hide resolved
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Outdated
Show resolved
Hide resolved
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Outdated
Show resolved
Hide resolved
packages/dashboard-frontend/tests/services/remote-cached-data-provider.test.js
Outdated
Show resolved
Hide resolved
5bc6e36
to
e4447a3
Compare
18a4890
to
0ae3d8c
Compare
79277b0
to
f79718c
Compare
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes https://github.com/Yoast/reserved-tasks/issues/515