m3_lightmeter/test/data/models/camera_features_config_test.dart
2025-05-12 16:04:24 +02:00

52 lines
1.1 KiB
Dart

import 'package:lightmeter/data/models/camera_feature.dart';
import 'package:test/test.dart';
void main() {
group(
'fromJson()',
() {
test('All keys', () {
expect(
CameraFeaturesConfigJson.fromJson(
{
'spotMetering': true,
'histogram': true,
'showFocalLength': true,
},
),
{
CameraFeature.spotMetering: true,
CameraFeature.histogram: true,
CameraFeature.showFocalLength: true,
},
);
});
test('Legacy', () {
expect(
CameraFeaturesConfigJson.fromJson({}),
{
CameraFeature.spotMetering: true,
CameraFeature.histogram: false,
CameraFeature.showFocalLength: true,
},
);
});
},
);
test('toJson()', () {
expect(
{
CameraFeature.spotMetering: true,
CameraFeature.histogram: true,
CameraFeature.showFocalLength: true,
}.toJson(),
{
'spotMetering': true,
'histogram': true,
'showFocalLength': true,
},
);
});
}