rehlma / flutter-seed-through-servicesr1
Seed stored state through production services
PublicStart with empty fake storage and write seed state through the real persistence service.
tests, run by the registry5 passed · slowest 1.7 ms
✓fires1.7 ms
reports newly written problematic code
write test/unit/storage_test.dart · in fixtures/flutterfired: line 1
final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});✓quiet1.7 ms
allows the intended form
write test/unit/storage_test.dart · in fixtures/flutterstayed quiet
final store = InMemorySharedPreferencesAsync.empty();✓quiet1.5 ms
does not apply to a pure Dart package
write test/unit/storage_test.dart · in fixtures/dartstayed quiet
final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});✓skips0.0 ms
does not judge reads
read test/unit/storage_test.dart · in fixtures/flutterno handler of the detector wants this event
final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});✓quiet1.4 ms
does not report an untouched legacy line
write test/unit/storage_test.dart · in fixtures/flutter · wrote line 2stayed quiet
final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});
final added = 1;detector.test.tseach detect() call runs the real detector
import { expect, test } from 'vitest';
import { detect, write, edit, read, command, output, prompt } from '@wellactually/sdk/v3/test';
const flutter = { project: 'fixtures/flutter' };
const dart = { project: 'fixtures/dart' };
test('reports newly written problematic code', () => {
expect(detect(write("test/unit/storage_test.dart", "final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});"), flutter)).toEqual([{ line: 1 }]);
});
test('allows the intended form', () => {
expect(detect(write("test/unit/storage_test.dart", "final store = InMemorySharedPreferencesAsync.empty();"), flutter)).toEqual([]);
});
test('does not apply to a pure Dart package', () => {
expect(detect(write("test/unit/storage_test.dart", "final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});"), dart)).toEqual([]);
});
test('does not judge reads', () => {
expect(detect(read("test/unit/storage_test.dart", "final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});"), flutter)).toEqual([]);
});
test('does not report an untouched legacy line', () => {
expect(detect(edit("test/unit/storage_test.dart", "final store = InMemorySharedPreferencesAsync.withData({'token': 'value'});\nfinal added = 1;", { written: 'final added = 1;' }), flutter)).toEqual([]);
});