Skip to content

Conversation

@zupat
Copy link
Owner

@zupat zupat commented Mar 14, 2024

Description

Re: #15

Test used to verify behaviour:

@yousefak007 lmk if it's missing anything.

final countRef = Ref.scoped((ctx) => 1);

await tester.pumpWidget(
        MaterialApp(
          home: LiteRefScope(
            child: Builder(
              builder: (context) {
                final initialized = countRef.exists(context);
                expect(initialized, false);

                final val = countRef.of(context);
                expect(val, 1);

                final initialized2 = countRef.exists(context);
                expect(initialized2, true);

                return LiteRefScope(
                  overrides: [
                    countRef.overrideWith((ctx) => 2),
                  ],
                  child: Builder(
                    builder: (context) {
                      final initialized = countRef.exists(context);
                      expect(initialized, false);

                      final val = countRef.of(context);
                      expect(val, 2);

                      final initialized2 = countRef.exists(context);
                      expect(initialized2, true);

                      return Text('$val');
                    },
                  ),
                );
              },
            ),
          ),
        ),
      );

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@codecov
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (1485546) to head (7b43259).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #16   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          145       149    +4     
=========================================
+ Hits           145       149    +4     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YousefAK009
Copy link

YousefAK009 commented Mar 14, 2024

Thanks, Yes this is good

@zupat zupat merged commit ab1f4ea into main Mar 14, 2024
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.

3 participants