split singleton into a different class

This commit is contained in:
shenlong-tanwen
2026-05-13 00:56:56 +05:30
parent d0f0e59334
commit 8fa425fbf7
18 changed files with 48 additions and 45 deletions
@@ -14,7 +14,7 @@ void main() {
setUpAll(() async {
ctx = MediumRepositoryContext();
sut = await MetadataRepository.ensureInitialized(ctx.db);
sut = MetadataRepository(ctx.db);
});
tearDownAll(() async {
@@ -23,7 +23,7 @@ void main() {
setUp(() async {
await ctx.db.delete(ctx.db.metadataEntity).go();
await MetadataRepository.refresh();
await sut.refresh();
});
group('defaults', () {
@@ -78,7 +78,7 @@ void main() {
// Cache hasn't seen this row yet — view still returns the default.
expect(sut.appConfig.theme.mode, ThemeMode.system);
await MetadataRepository.refresh();
await sut.refresh();
expect(sut.appConfig.theme.mode, ThemeMode.dark);
});
@@ -88,7 +88,7 @@ void main() {
await ctx.db.delete(ctx.db.metadataEntity).go();
expect(sut.appConfig.theme.mode, ThemeMode.dark);
await MetadataRepository.refresh();
await sut.refresh();
expect(sut.appConfig.theme.mode, ThemeMode.system);
});
@@ -103,7 +103,7 @@ void main() {
),
);
await MetadataRepository.refresh();
await sut.refresh();
expect(sut.appConfig.theme.mode, ThemeMode.system);
});
});