mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-11-03 06:37:05 +01:00
The hub's two fetch lists, its push map, the encryption verifier lookup and the account delete/reset lists each named every collection. They now all come from SyncItemCollections on the repository accessor, which also marks the legacy settings collection as deleted but not synced. A test checks every repository is registered.
28 lines
981 B
C#
28 lines
981 B
C#
using Notesnook.API.Repositories;
|
|
|
|
namespace Notesnook.API.Tests;
|
|
|
|
public class SyncItemCollectionsTests(TestDatabase db) : IClassFixture<TestDatabase>
|
|
{
|
|
// sync, push, reset and account deletion all read this list, so a repository missing from it
|
|
// would silently be neither synced nor deleted
|
|
[Fact]
|
|
public void Every_sync_item_repository_is_registered()
|
|
{
|
|
var accessor = db.CreateScope().Repositories;
|
|
var repositories = accessor.GetType().GetProperties()
|
|
.Where((p) => p.PropertyType == typeof(SyncItemsRepository))
|
|
.Select((p) => p.GetValue(accessor))
|
|
.ToHashSet();
|
|
|
|
Assert.Equal(repositories, accessor.SyncItemCollections.Select((c) => c.Repository).ToHashSet<object?>());
|
|
}
|
|
|
|
[Fact]
|
|
public void Relations_sync_last()
|
|
{
|
|
var accessor = db.CreateScope().Repositories;
|
|
Assert.Equal("relation", accessor.SyncItemCollections.Last((c) => c.Type != null).Type);
|
|
}
|
|
}
|