-
-
Notifications
You must be signed in to change notification settings - Fork 4
Move and handle writing systems effectively #1890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a028006
create move WritingSystem api with test
hahn-kev d266d27
implement move writing system for FwData
hahn-kev 2983af6
implement moving ws in LcmCrdt
hahn-kev 500ad5c
handle diff orderable writing systems
hahn-kev 771a1a9
Mark WritingSystem.Order as MiniLcmInternal
myieye 3b577ee
Implement inserting WritingSystems
myieye 2935308
AI feedback
myieye 0776aad
Remove internal order value from demo ts data
myieye c8713f0
Fix method signature
myieye d47573d
reuse exiting repo when possible
hahn-kev 8d4a3d4
update unreliable api so it compiles
hahn-kev 364e5c0
Fix lint
myieye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
backend/FwLite/FwLiteProjectSync.Tests/WritingSystemSyncTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using FwLiteProjectSync.Tests.Fixtures; | ||
using MiniLcm.Models; | ||
|
||
namespace FwLiteProjectSync.Tests; | ||
|
||
public class WritingSystemSyncTests : IClassFixture<SyncFixture>, IAsyncLifetime | ||
{ | ||
|
||
private readonly SyncFixture _fixture; | ||
private readonly CrdtFwdataProjectSyncService _syncService; | ||
|
||
public WritingSystemSyncTests(SyncFixture fixture) | ||
{ | ||
_fixture = fixture; | ||
_syncService = _fixture.SyncService; | ||
} | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
await _fixture.FwDataApi.CreateEntry(new Entry() | ||
{ | ||
Id = Guid.NewGuid(), | ||
LexemeForm = { { "en", "Pineapple" } }, | ||
}); | ||
await _fixture.FwDataApi.CreateWritingSystem(new WritingSystem() | ||
{ | ||
Id = Guid.NewGuid(), | ||
Type = WritingSystemType.Vernacular, | ||
WsId = new WritingSystemId("fr"), | ||
Name = "French", | ||
Abbreviation = "fr", | ||
Font = "Arial" | ||
}); | ||
await _syncService.Sync(_fixture.CrdtApi, _fixture.FwDataApi); | ||
} | ||
|
||
public async Task DisposeAsync() | ||
{ | ||
await foreach (var entry in _fixture.FwDataApi.GetAllEntries()) | ||
{ | ||
await _fixture.FwDataApi.DeleteEntry(entry.Id); | ||
} | ||
|
||
foreach (var entry in await _fixture.CrdtApi.GetAllEntries().ToArrayAsync()) | ||
{ | ||
await _fixture.CrdtApi.DeleteEntry(entry.Id); | ||
} | ||
} | ||
|
||
[Fact] | ||
public async Task SyncWs_UpdatesOrder() | ||
{ | ||
var en = await _fixture.FwDataApi.GetWritingSystem("en", WritingSystemType.Vernacular); | ||
en.Should().NotBeNull(); | ||
en.Order.Should().Be(0); | ||
var fr = await _fixture.FwDataApi.GetWritingSystem("fr", WritingSystemType.Vernacular); | ||
fr.Should().NotBeNull(); | ||
fr.Order.Should().Be(1); | ||
await _fixture.FwDataApi.MoveWritingSystem("fr", WritingSystemType.Vernacular, new(null, "en")); | ||
fr = await _fixture.FwDataApi.GetWritingSystem("fr", WritingSystemType.Vernacular); | ||
fr.Should().NotBeNull(); | ||
fr.Order.Should().Be(0); | ||
var crdtFr = await _fixture.CrdtApi.GetWritingSystem("fr", WritingSystemType.Vernacular); | ||
crdtFr.Should().NotBeNull(); | ||
crdtFr.Order.Should().Be(1); | ||
Check failure on line 65 in backend/FwLite/FwLiteProjectSync.Tests/WritingSystemSyncTests.cs
|
||
|
||
await _syncService.Sync(_fixture.CrdtApi, _fixture.FwDataApi); | ||
|
||
fr = await _fixture.FwDataApi.GetWritingSystem("fr", WritingSystemType.Vernacular); | ||
fr.Should().NotBeNull(); | ||
fr.Order.Should().Be(0); | ||
|
||
var crdtEn = await _fixture.CrdtApi.GetWritingSystem("en", WritingSystemType.Vernacular); | ||
crdtEn.Should().NotBeNull(); | ||
var actualFr = await _fixture.CrdtApi.GetWritingSystem("fr", WritingSystemType.Vernacular); | ||
actualFr.Should().NotBeNull(); | ||
actualFr.Order.Should().BeLessThan(crdtEn.Order); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.