Skip to content

Commit dab20e0

Browse files
committed
refactor(test): rename type to sourceType in tests
- Aligned with model changes - Improves test readability
1 parent 4541d0d commit dab20e0

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

test/src/models/news/source_test.dart

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void main() {
3030
name: testName,
3131
description: testDescription,
3232
url: testUrl,
33-
type: testType,
33+
sourceType: testType,
3434
language: testLanguage,
3535
headquarters: testCountry,
3636
);
@@ -49,7 +49,7 @@ void main() {
4949
);
5050
expect(minimalSource.description, isNull);
5151
expect(minimalSource.url, isNull);
52-
expect(minimalSource.type, isNull);
52+
expect(minimalSource.sourceType, isNull);
5353
expect(minimalSource.language, isNull);
5454
expect(minimalSource.headquarters, isNull);
5555
});
@@ -59,7 +59,7 @@ void main() {
5959
expect(fullSource.name, testName);
6060
expect(fullSource.description, testDescription);
6161
expect(fullSource.url, testUrl);
62-
expect(fullSource.type, testType);
62+
expect(fullSource.sourceType, testType);
6363
expect(fullSource.language, testLanguage);
6464
expect(fullSource.headquarters, testCountry);
6565
});
@@ -74,7 +74,7 @@ void main() {
7474
testName,
7575
testDescription,
7676
testUrl,
77-
testType,
77+
testType, // This is the value of sourceType
7878
testLanguage,
7979
testCountry,
8080
]),
@@ -87,7 +87,7 @@ void main() {
8787
name: testName,
8888
description: testDescription,
8989
url: testUrl,
90-
type: testType,
90+
sourceType: testType,
9191
language: testLanguage,
9292
headquarters: testCountry,
9393
);
@@ -96,7 +96,7 @@ void main() {
9696
name: testName,
9797
description: testDescription,
9898
url: testUrl,
99-
type: testType,
99+
sourceType: testType,
100100
language: testLanguage,
101101
headquarters: testCountry,
102102
);
@@ -168,7 +168,7 @@ void main() {
168168
expect(source.name, testName);
169169
expect(source.description, isNull);
170170
expect(source.url, isNull);
171-
expect(source.type, isNull);
171+
expect(source.sourceType, isNull);
172172
expect(source.language, isNull);
173173
expect(source.headquarters, isNull);
174174
});
@@ -188,7 +188,7 @@ void main() {
188188
expect(source.name, testName);
189189
expect(source.description, testDescription);
190190
expect(source.url, testUrl);
191-
expect(source.type, testType);
191+
expect(source.sourceType, testType);
192192
expect(source.language, testLanguage);
193193
expect(
194194
source.headquarters,
@@ -205,7 +205,7 @@ void main() {
205205
final source = Source.fromJson(jsonWithMissing);
206206
expect(source.description, isNull);
207207
expect(source.url, isNull);
208-
expect(source.type, isNull);
208+
expect(source.sourceType, isNull);
209209
expect(source.language, isNull);
210210
expect(source.headquarters, isNull);
211211
});
@@ -223,7 +223,7 @@ void main() {
223223
final source = Source.fromJson(jsonWithNulls);
224224
expect(source.description, isNull);
225225
expect(source.url, isNull);
226-
expect(source.type, isNull);
226+
expect(source.sourceType, isNull);
227227
expect(source.language, isNull);
228228
expect(source.headquarters, isNull);
229229
});
@@ -235,7 +235,7 @@ void main() {
235235
'type': 'some-unknown-type',
236236
};
237237
final source = Source.fromJson(jsonWithUnknownType);
238-
expect(source.type, isNull); // Should default to null
238+
expect(source.sourceType, isNull); // Should default to null
239239
});
240240
});
241241

@@ -269,7 +269,10 @@ void main() {
269269
updatedDesc,
270270
);
271271
expect(fullSource.copyWith(url: updatedUrl).url, updatedUrl);
272-
expect(fullSource.copyWith(type: updatedType).type, updatedType);
272+
expect(
273+
fullSource.copyWith(sourceType: updatedType).sourceType,
274+
updatedType,
275+
);
273276
expect(
274277
fullSource.copyWith(language: updatedLang).language,
275278
updatedLang,
@@ -285,14 +288,14 @@ void main() {
285288
const updatedType = SourceType.aggregator;
286289
final updatedCopy = fullSource.copyWith(
287290
name: updatedName,
288-
type: updatedType,
291+
sourceType: updatedType,
289292
);
290293

291294
expect(updatedCopy.id, fullSource.id); // Unchanged
292295
expect(updatedCopy.name, updatedName); // Changed
293296
expect(updatedCopy.description, fullSource.description); // Unchanged
294297
expect(updatedCopy.url, fullSource.url); // Unchanged
295-
expect(updatedCopy.type, updatedType); // Changed
298+
expect(updatedCopy.sourceType, updatedType); // Changed
296299
expect(updatedCopy.language, fullSource.language); // Unchanged
297300
expect(updatedCopy.headquarters, fullSource.headquarters); // Unchanged
298301
});

0 commit comments

Comments
 (0)