Skip to content

Commit b334094

Browse files
committed
apply some suggested minor fixes around debugger helpers
1 parent f1242e5 commit b334094

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

backend/FwLite/LcmDebugger/FakeSyncSource.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public static FakeSyncSource FromJsonFile(string path, JsonSerializerOptions? op
5050
};
5151
}
5252

53-
var changes = JsonSerializer.Deserialize<ChangesResult<Commit>>(File.OpenRead(path), options);
53+
using var file = File.OpenRead(path);
54+
var changes = JsonSerializer.Deserialize<ChangesResult<Commit>>(file, options);
5455
ArgumentNullException.ThrowIfNull(changes);
5556
ArgumentNullException.ThrowIfNull(changes.MissingFromClient);
5657
ArgumentNullException.ThrowIfNull(changes.ServerSyncState);

backend/FwLite/LcmDebugger/Utils.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public static async Task<CrdtMiniLcmApi> NewProjectFromSyncable(this IServicePro
5252
var crdtProjectsService = services.GetRequiredService<CrdtProjectsService>();
5353
var crdtProject = await crdtProjectsService.CreateProject(new CrdtProjectsService.CreateProjectRequest("test-project", $"test-{Guid.NewGuid().ToString().Split('-')[0]}", projectId));
5454
var crdtMiniLcmApi = (CrdtMiniLcmApi)await crdtProjectsService.OpenProject(crdtProject, services);
55-
await services.GetRequiredService<DataModel>().SyncWith(syncable);
55+
var syncResult = await services.GetRequiredService<DataModel>().SyncWith(syncable);
56+
if (!syncResult.IsSynced)
57+
throw new InvalidOperationException("New project sync failed.");
5658
return crdtMiniLcmApi;
5759
}
5860

0 commit comments

Comments
 (0)