@@ -29,17 +29,19 @@ void main() {
2929 });
3030
3131 test ('should initialize with custom key' , () async {
32+ // ggignore: test-key-not-real
3233 const config = EncryptionConfig (
3334 enabled: true ,
34- customKey: 'my-custom- key-12345' ,
35+ customKey: 'test- key-for-unit-tests-only -12345' ,
3536 );
3637 final manager = EncryptionManager (config);
3738 final platform = LocalStorageCachePlatform .instance;
3839
3940 await manager.initialize (platform);
4041
4142 // Should use custom key
42- expect (manager.config.customKey, equals ('my-custom-key-12345' ));
43+ expect (manager.config.customKey,
44+ equals ('test-key-for-unit-tests-only-12345' ));
4345 });
4446
4547 test ('should generate and save key to secure storage' , () async {
@@ -60,8 +62,10 @@ void main() {
6062 test ('should load existing key from secure storage' , () async {
6163 final platform = LocalStorageCachePlatform .instance;
6264
65+ // ggignore: test-key-not-real
6366 // Save a key first
64- await platform.saveSecureKey ('encryption_key' , 'existing-key-123' );
67+ await platform.saveSecureKey (
68+ 'encryption_key' , 'mock-existing-key-for-testing-123' );
6569
6670 const config = EncryptionConfig (
6771 enabled: true ,
@@ -72,7 +76,7 @@ void main() {
7276
7377 // Should load the existing key
7478 final loadedKey = await platform.getSecureKey ('encryption_key' );
75- expect (loadedKey, equals ('existing-key-123' ));
79+ expect (loadedKey, equals ('mock- existing-key-for-testing -123' ));
7680 });
7781
7882 test ('should throw StateError when not initialized' , () async {
@@ -226,10 +230,11 @@ void main() {
226230 });
227231
228232 test ('should encrypt specific fields in data map' , () async {
233+ // ggignore: test-password-not-real
229234 final data = {
230235 'username' : 'john_doe' ,
231236 'email' : 'john@example.com' ,
232- 'password' : 'secret123 ' ,
237+ 'password' : 'test-password-not-real-123 ' ,
233238 'age' : 30 ,
234239 };
235240
@@ -240,15 +245,17 @@ void main() {
240245
241246 expect (encrypted['username' ], equals ('john_doe' ));
242247 expect (encrypted['age' ], equals (30 ));
243- expect (encrypted['password' ], isNot (equals ('secret123' )));
248+ expect (
249+ encrypted['password' ], isNot (equals ('test-password-not-real-123' )));
244250 expect (encrypted['email' ], isNot (equals ('john@example.com' )));
245251 });
246252
247253 test ('should decrypt specific fields in data map' , () async {
254+ // ggignore: test-password-not-real
248255 final data = {
249256 'username' : 'john_doe' ,
250257 'email' : 'john@example.com' ,
251- 'password' : 'secret123 ' ,
258+ 'password' : 'test-password-not-real-123 ' ,
252259 };
253260
254261 final encrypted = await manager.encryptFields (
@@ -262,15 +269,16 @@ void main() {
262269 );
263270
264271 expect (decrypted['username' ], equals ('john_doe' ));
265- expect (decrypted['password' ], equals ('secret123 ' ));
272+ expect (decrypted['password' ], equals ('test-password-not-real-123 ' ));
266273 expect (decrypted['email' ], equals ('john@example.com' ));
267274 });
268275
269276 test ('should handle null values in fields' , () async {
277+ // ggignore: test-password-not-real
270278 final data = {
271279 'username' : 'john_doe' ,
272280 'email' : null ,
273- 'password' : 'secret123 ' ,
281+ 'password' : 'test-password-not-real-123 ' ,
274282 };
275283
276284 final encrypted = await manager.encryptFields (
@@ -279,13 +287,15 @@ void main() {
279287 );
280288
281289 expect (encrypted['email' ], isNull);
282- expect (encrypted['password' ], isNot (equals ('secret123' )));
290+ expect (
291+ encrypted['password' ], isNot (equals ('test-password-not-real-123' )));
283292 });
284293
285294 test ('should handle missing fields' , () async {
295+ // ggignore: test-password-not-real
286296 final data = {
287297 'username' : 'john_doe' ,
288- 'password' : 'secret123 ' ,
298+ 'password' : 'test-password-not-real-123 ' ,
289299 };
290300
291301 final encrypted = await manager.encryptFields (
@@ -294,15 +304,17 @@ void main() {
294304 );
295305
296306 expect (encrypted['username' ], equals ('john_doe' ));
297- expect (encrypted['password' ], isNot (equals ('secret123' )));
307+ expect (
308+ encrypted['password' ], isNot (equals ('test-password-not-real-123' )));
298309 expect (encrypted.containsKey ('email' ), isFalse);
299310 expect (encrypted.containsKey ('phone' ), isFalse);
300311 });
301312
302313 test ('should handle empty fields list' , () async {
314+ // ggignore: test-password-not-real
303315 final data = {
304316 'username' : 'john_doe' ,
305- 'password' : 'secret123 ' ,
317+ 'password' : 'test-password-not-real-123 ' ,
306318 };
307319
308320 final encrypted = await manager.encryptFields (data, []);
@@ -353,7 +365,8 @@ void main() {
353365 });
354366
355367 test ('should set new encryption key' , () async {
356- const newKey = 'new-encryption-key-456' ;
368+ // ggignore: test-key-not-real
369+ const newKey = 'test-new-encryption-key-for-testing-456' ;
357370
358371 await manager.setEncryptionKey (newKey);
359372
@@ -374,8 +387,9 @@ void main() {
374387 });
375388
376389 test ('should save custom key securely' , () async {
390+ // ggignore: test-key-not-real
377391 const keyId = 'custom_key_1' ;
378- const keyValue = 'my -custom-key-value' ;
392+ const keyValue = 'test -custom-key-value-for-unit-tests ' ;
379393
380394 await manager.saveKeySecurely (keyId, keyValue);
381395
@@ -411,6 +425,7 @@ void main() {
411425 });
412426
413427 test ('should return plain text when encryption is disabled' , () async {
428+ // ggignore: test-data-not-sensitive
414429 const plainText = 'Hello, World!' ;
415430
416431 final encrypted = await manager.encrypt (plainText);
@@ -421,9 +436,10 @@ void main() {
421436 });
422437
423438 test ('should not encrypt fields when disabled' , () async {
439+ // ggignore: test-password-not-real
424440 final data = {
425441 'username' : 'john_doe' ,
426- 'password' : 'secret123 ' ,
442+ 'password' : 'test-password-not-real-123 ' ,
427443 };
428444
429445 final encrypted = await manager.encryptFields (data, ['password' ]);
0 commit comments