Skip to content

Commit 4834a66

Browse files
refactor(tests): enhance type safety and readability in policy test assertions
1 parent c14be9c commit 4834a66

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

test/core/policy_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,10 @@ void main() {
432432
final policy = Policy.fromJson(json);
433433

434434
expect(policy.metadata, equals(complexMetadata));
435-
expect(policy.metadata['nested']!['array'], equals([1, 2, 3]));
435+
expect(
436+
(policy.metadata['nested'] as Map<String, dynamic>)['array'],
437+
equals([1, 2, 3]),
438+
);
436439
});
437440
});
438441

test/utils/json_handler_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ class TestPolicy {
9393
metadata.entries.every((entry) {
9494
final otherValue = other.metadata[entry.key];
9595
if (entry.value is List && otherValue is List) {
96-
return entry.value.length == otherValue.length &&
97-
(entry.value as List)
98-
.every((item) => otherValue.contains(item));
96+
final valueList = entry.value as List;
97+
return valueList.length == otherValue.length &&
98+
valueList.every((item) => otherValue.contains(item));
9999
}
100100
return entry.value == otherValue;
101101
});

0 commit comments

Comments
 (0)