mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-30 10:50:45 +00:00
.github
android
assets
ios
lib
res
test
fixtures
api_test.dart
barcode_test.dart
models_test.dart
preferences_test.dart
setup.dart
user_profile_test.dart
wedge_scanner_test.dart
widget_test.dart
.gitignore
.gitmodules
.metadata
BUILDING.md
LICENSE
README.md
analysis_options.yaml
crowdin.yml
find_dart_files.py
l10n.yaml
pubspec.lock
pubspec.yaml
requirements.txt
tasks.py
* Display stock quantity more prominently * Cleanup search widget * Update for stock_detail widget * More tweaks * Change bottom bar icon * Display boolean parameters appropriately * Adds ability to edit part parameters * Bump icon size a bit * Improvements to filter options - Allow filtering by "option" type - To start with, filter stock by status code * Remove debug message * Remove getTriState method - No longer needed - Remove associated unit tests * Adjust filters based on server API version * Muted colors
51 lines
1.5 KiB
Dart
51 lines
1.5 KiB
Dart
/*
|
|
* Unit tests for the preferences manager
|
|
*/
|
|
|
|
import "package:flutter_test/flutter_test.dart";
|
|
import "package:inventree/preferences.dart";
|
|
|
|
import "setup.dart";
|
|
|
|
void main() {
|
|
setupTestEnv();
|
|
|
|
setUp(() async {
|
|
});
|
|
|
|
group("Settings Tests:", () {
|
|
test("Default Values", () async {
|
|
// Boolean values
|
|
expect(await InvenTreeSettingsManager().getBool("test", false), equals(false));
|
|
expect(await InvenTreeSettingsManager().getBool("test", true), equals(true));
|
|
|
|
// String values
|
|
expect(await InvenTreeSettingsManager().getValue("test", "x"), equals("x"));
|
|
});
|
|
|
|
test("Set value", () async {
|
|
await InvenTreeSettingsManager().setValue("abc", "xyz");
|
|
|
|
expect(await InvenTreeSettingsManager().getValue("abc", "123"), equals("xyz"));
|
|
});
|
|
|
|
test("Booleans", () async {
|
|
// Tests for boolean values
|
|
|
|
await InvenTreeSettingsManager().removeValue("chicken");
|
|
|
|
// Use default values when a setting does not exist
|
|
assert(await InvenTreeSettingsManager().getBool("chicken", true) == true);
|
|
assert(await InvenTreeSettingsManager().getBool("chicken", false) == false);
|
|
|
|
// Explicitly set to true
|
|
await InvenTreeSettingsManager().setValue("chicken", true);
|
|
assert(await InvenTreeSettingsManager().getBool("chicken", false) == true);
|
|
|
|
// Explicitly set to false
|
|
await InvenTreeSettingsManager().setValue("chicken", false);
|
|
assert(await InvenTreeSettingsManager().getBool("chicken", true) == false);
|
|
|
|
});
|
|
});
|
|
} |