-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75c90ec
commit 9c14443
Showing
6 changed files
with
170 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Flutter Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Run Flutter Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the repository | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
# Set up Flutter with a specified version | ||
- name: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: '3.19.0' # Specify Flutter version >= 3.19.0 | ||
|
||
# Run flutter pub get to fetch dependencies | ||
- name: Install Dependencies | ||
run: flutter pub get | ||
|
||
# Run flutter tests | ||
- name: Run Tests | ||
run: flutter test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,3 +73,5 @@ ios/fastlane/.env | |
ios/fastlane/report.xml | ||
|
||
lib/home/Chat/chat_config.dart | ||
|
||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
import 'package:mockito/mockito.dart'; | ||
import 'package:swiftcomp/home/more/feature_flag_provider.dart'; | ||
|
||
void main() { | ||
group('FeatureFlagProvider Tests', () { | ||
late FeatureFlagProvider featureFlagProvider; | ||
|
||
setUp(() async { | ||
SharedPreferences.setMockInitialValues({}); // Initialize with no values | ||
featureFlagProvider = FeatureFlagProvider(); | ||
await featureFlagProvider.loadFeatureFlags(); | ||
}); | ||
|
||
test('Initial feature flag values should be false', () async { | ||
expect(featureFlagProvider.getFeatureFlag('Chat'), false); | ||
}); | ||
|
||
test('Feature flag toggles and persists the new value', () async { | ||
await featureFlagProvider.toggleFeatureFlag('Chat'); | ||
|
||
expect(featureFlagProvider.getFeatureFlag('Chat'), true); | ||
}); | ||
|
||
test('Loading feature flags from SharedPreferences', () async { | ||
SharedPreferences.setMockInitialValues({'Chat': true}); | ||
featureFlagProvider = FeatureFlagProvider(); | ||
await featureFlagProvider.loadFeatureFlags(); | ||
|
||
expect(featureFlagProvider.getFeatureFlag('Chat'), true); | ||
}); | ||
}); | ||
} |