Skip to content

feat: add dict preference model#1

Merged
PaoloProdossimoLopes merged 4 commits intodevelopfrom
feature/dict
May 24, 2025
Merged

feat: add dict preference model#1
PaoloProdossimoLopes merged 4 commits intodevelopfrom
feature/dict

Conversation

@PaoloProdossimoLopes
Copy link
Contributor

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Evidence

Please ignore is not relevant.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for storing and retrieving dictionary preferences ([String: Any]) across the adapter, getter, setter, and provider layers, and introduces corresponding tests.

  • Added getDict/setDict methods to UserDefaultPreferenceAdapter, its getter/setter adapters, providers, and protocols.
  • Extended test doubles and test suites to cover dictionary operations.
  • Updated Package.swift to reference branch “main” for dependencies.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/.../UserDefaultPreferenceSetterAdapterTests.swift Added SetDictTests to verify setDict behavior.
Tests/.../UserDefaultPreferenceGetterAdapterTests.swift Renamed suites/tests and added DictTests for getDict.
Tests/.../UserDefaultPreferenceAdapterTests.swift Added DictTests and SetDictTests for adapter.
Tests/.../Doubles/PreferenceSetterDouble.swift Added setDictMocked and expectDict.
Tests/.../Doubles/PreferenceGetterDouble.swift Added getDictMocked.
Sources/.../UserDefaultPreferenceAdapter.swift Implemented getDict/setDict methods and docs.
Sources/.../PreferenceSetterProvider.swift Added setDict support in UserDefaultPreferenceSetterAdapter.
Sources/.../PreferenceGetterProvider.swift Added getDict support in UserDefaultPreferenceGetterAdapter.
Sources/.../PreferenceSetter.swift & PreferenceGetter.swift & Preference.swift Extended protocols to include dictionary methods.
Package.swift Changed dependencies to track main branches.
Comments suppressed due to low confidence (4)

Tests/EasyUserDefaultPreferenceTests/UserDefaultPreferenceAdapterTests.swift:207

  • The suite annotation .getDict(value:) doesn’t match the method signature getDict(_ key:). Rename it to .getDict(key:) to reflect the correct parameter name.
@Suite(".getDict(value:)")

Tests/EasyUserDefaultPreferenceTests/UserDefaultPreferenceGetterAdapterTests.swift:66

  • This suite is for IntTests but references .getBool(key:). It should be .getInt(key:) to match the tested method.
@Suite(".getBool(key:)")

Tests/EasyUserDefaultPreferenceTests/UserDefaultPreferenceGetterAdapterTests.swift:254

  • [nitpick] The test description mentions true but is testing dictionary retrieval. Update it to something like should return stored dictionary when present.
@Test("should return when true is stored")

Tests/EasyUserDefaultPreferenceTests/UserDefaultPreferenceGetterAdapterTests.swift:262

  • [nitpick] The test description refers to false but actually validates a dictionary. Rename to clarify it's testing a different dictionary value.
@Test("should return other data when false is stored")

Comment on lines +20 to +24
branch: "main"
),
.package(path: "../EasyTesting")
.package(
url: "https://github.com/EasyPackages/EasyTesting.git",
branch: "main"
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

Pinning dependencies to the main branch can introduce instability. Consider using a version-based requirement to ensure reproducible builds.

Copilot uses AI. Check for mistakes.
@PaoloProdossimoLopes PaoloProdossimoLopes merged commit cf22e0e into develop May 24, 2025
1 check passed
@PaoloProdossimoLopes PaoloProdossimoLopes deleted the feature/dict branch May 24, 2025 10:46
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