Skip to content
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

Cleanup ContentBlockerProtectionStoreTests #1803

Open
mauriciomaniglia opened this issue Jun 30, 2023 · 0 comments
Open

Cleanup ContentBlockerProtectionStoreTests #1803

mauriciomaniglia opened this issue Jun 30, 2023 · 0 comments

Comments

@mauriciomaniglia
Copy link
Contributor

ContentBlockerProtectionStoreTests has some unused code.

First, we have an unnecessary import from the DuckDuckGo module.

Second, on line 39, there's a call to FileStore that is not needed for what is being tested.
try FileStore().persist(configFile, for: .privacyConfiguration)
If we remove this line, we can also remove the throws keyword from the test.

We also have some asserts that I didn't see the need to add since they do not influence what is being tested.
Line 42: XCTAssertEqual(privacyConfigurationManager.embeddedConfigData.etag, AppPrivacyConfigurationDataProvider.Constants.embeddedDataETag)

Line 47: XCTAssertNotNil(newConfig)
This one in particular, if we force the unwrap here, we don't need this check and the if let bellow this line. I don't see a problem in forcing the unwrap here since we are unit testing and are sure we are providing the correct dependencies.

If we move some parts of this code to separate functions, we can make this test more readable and organized in the structure GIVEN WHEN THEN.

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

No branches or pull requests

2 participants