Skip to content

Commit f595b5c

Browse files
committed
fix after rebase
1 parent 3051f0e commit f595b5c

File tree

5 files changed

+42
-36
lines changed

5 files changed

+42
-36
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/translate/biblical-terms/biblical-term-dialog.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe('BiblicalTermDialogComponent', () => {
145145
expect(biblicalTerm.data?.description).toBe('');
146146
}));
147147

148-
it('should not save renderings with unbalanced parentheses', fakeAsync(() => {
148+
it('should not save renderings with unbalanced parentheses', fakeAsync(async () => {
149149
const env = new TestEnvironment();
150150
env.setupProjectData('en');
151151
env.wait();
@@ -154,12 +154,12 @@ describe('BiblicalTermDialogComponent', () => {
154154
env.setTextFieldValue(env.renderings, '(');
155155
env.click(env.submitButton);
156156
env.wait();
157-
const biblicalTerm = env.getBiblicalTermDoc('id01');
157+
const biblicalTerm = await env.getBiblicalTermDoc('id01');
158158
expect(biblicalTerm.data?.renderings).toEqual(['rendering01']);
159159
env.closeDialog();
160160
}));
161161

162-
it('should save renderings with balanced parentheses', fakeAsync(() => {
162+
it('should save renderings with balanced parentheses', fakeAsync(async () => {
163163
const env = new TestEnvironment();
164164
env.setupProjectData('en');
165165
env.wait();
@@ -168,7 +168,7 @@ describe('BiblicalTermDialogComponent', () => {
168168
env.setTextFieldValue(env.renderings, '()');
169169
env.click(env.submitButton);
170170
env.wait();
171-
const biblicalTerm = env.getBiblicalTermDoc('id01');
171+
const biblicalTerm = await env.getBiblicalTermDoc('id01');
172172
expect(biblicalTerm.data?.renderings).toEqual(['()']);
173173
}));
174174

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-history-list/draft-history-entry/draft-history-entry.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { UserProfileDoc } from 'xforge-common/models/user-profile-doc';
1515
import { TestRealtimeModule } from 'xforge-common/test-realtime.module';
1616
import { configureTestingModule, TestTranslocoModule } from 'xforge-common/test-utils';
1717
import { UserService } from 'xforge-common/user.service';
18+
import { DocSubscription } from '../../../../../xforge-common/models/realtime-doc';
1819
import { SFProjectProfileDoc } from '../../../../core/models/sf-project-profile-doc';
1920
import { SF_TYPE_REGISTRY } from '../../../../core/models/sf-type-registry';
2021
import { TrainingDataDoc } from '../../../../core/models/training-data-doc';
@@ -235,7 +236,7 @@ describe('DraftHistoryEntryComponent', () => {
235236
id: 'project01',
236237
data: createTestProjectProfile({ shortName: 'tar', writingSystem: { tag: 'en' } })
237238
} as SFProjectProfileDoc;
238-
when(mockedSFProjectService.getProfile('project01')).thenResolve(targetProjectDoc);
239+
when(mockedSFProjectService.getProfile('project01', new DocSubscription('spec'))).thenResolve(targetProjectDoc);
239240
when(mockedActivatedProjectService.changes$).thenReturn(of(targetProjectDoc));
240241
const entry = {
241242
additionalInfo: {

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-preview-books/draft-preview-books.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ export class DraftPreviewBooksComponent {
168168
this.updateProgress();
169169

170170
const promises: Promise<string | undefined>[] = [];
171-
const targetProject = (await this.projectService.getProfile(targetProjectId)).data!;
171+
const targetProject = (
172+
await this.projectService.getProfile(
173+
targetProjectId,
174+
new DocSubscription('DraftPreviewBooksComponent', this.destroyRef)
175+
)
176+
).data!;
172177
for (const chapter of bookWithDraft.chaptersWithDrafts) {
173178
const draftTextDocId = new TextDocId(this.activatedProjectService.projectId!, bookWithDraft.bookNumber, chapter);
174179
const targetTextDocId = new TextDocId(targetProjectId, bookWithDraft.bookNumber, chapter);

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@ describe('EditorComponent', () => {
23462346
(insertDelta as any).push({ retain: remoteEditTextPos } as DeltaOperation);
23472347
(insertDelta as any).push({ insert: 'abc' } as DeltaOperation);
23482348
// Simulate remote changes coming in
2349-
textDoc.submit(insertDelta);
2349+
await textDoc.submit(insertDelta);
23502350

23512351
// SUT 1
23522352
env.wait();
@@ -2372,7 +2372,7 @@ describe('EditorComponent', () => {
23722372
(insertDeleteDelta as any).push({ retain: remoteEditTextPos } as DeltaOperation);
23732373
(insertDeleteDelta as any).push({ insert: 'defgh' } as DeltaOperation);
23742374
(insertDeleteDelta as any).push({ delete: selectionLength } as DeltaOperation);
2375-
textDoc.submit(insertDeleteDelta);
2375+
await textDoc.submit(insertDeleteDelta);
23762376

23772377
// SUT 2
23782378
env.wait();
@@ -2387,7 +2387,7 @@ describe('EditorComponent', () => {
23872387
(deleteDelta as any).push({ retain: remoteEditTextPos } as DeltaOperation);
23882388
// the remote edit deletes 4, but locally it is expanded to 6 to include the 2 note embeds
23892389
(deleteDelta as any).push({ delete: 4 } as DeltaOperation);
2390-
textDoc.submit(deleteDelta);
2390+
await textDoc.submit(deleteDelta);
23912391

23922392
// SUT 3
23932393
env.wait();
@@ -2436,7 +2436,7 @@ describe('EditorComponent', () => {
24362436
let deltaOps: DeltaOperation[] = [{ retain: remoteEditTextPos }, { insert: insert }];
24372437
const inSegmentDelta = new Delta(deltaOps);
24382438
const textDoc: TextDoc = await env.getTextDoc(new TextDocId('project01', 40, 1));
2439-
textDoc.submit(inSegmentDelta);
2439+
await textDoc.submit(inSegmentDelta);
24402440

24412441
// SUT 1
24422442
env.wait();
@@ -2451,7 +2451,7 @@ describe('EditorComponent', () => {
24512451
insert = 'def';
24522452
deltaOps = [{ retain: remoteEditTextPos }, { insert: insert }];
24532453
const outOfSegmentDelta = new Delta(deltaOps);
2454-
textDoc.submit(outOfSegmentDelta);
2454+
await textDoc.submit(outOfSegmentDelta);
24552455

24562456
// SUT 2
24572457
env.wait();
@@ -2467,7 +2467,7 @@ describe('EditorComponent', () => {
24672467
insert = 'before';
24682468
deltaOps = [{ retain: remoteEditTextPos }, { insert: insert }];
24692469
const insertDelta = new Delta(deltaOps);
2470-
textDoc.submit(insertDelta);
2470+
await textDoc.submit(insertDelta);
24712471
const note1Doc: NoteThreadDoc = await env.getNoteThreadDoc('project01', 'dataid01');
24722472
const anchor: TextAnchor = { start: 8 + insert.length, length: 12 };
24732473
await note1Doc.submitJson0Op(op => op.set(nt => nt.position, anchor));
@@ -2490,7 +2490,7 @@ describe('EditorComponent', () => {
24902490
insert = 'ghi';
24912491
deltaOps = [{ retain: remoteEditTextPos }, { insert: insert }];
24922492
const insertAfterNoteDelta = new Delta(deltaOps);
2493-
textDoc.submit(insertAfterNoteDelta);
2493+
await textDoc.submit(insertAfterNoteDelta);
24942494

24952495
// SUT 4
24962496
env.wait();
@@ -5057,7 +5057,7 @@ class TestEnvironment {
50575057
async deleteText(textId: string): Promise<void> {
50585058
await this.ngZone.run(async () => {
50595059
const textDoc = await this.realtimeService.get(TextDoc.COLLECTION, textId, new DocSubscription('spec'));
5060-
textDoc.delete();
5060+
await textDoc.delete();
50615061
});
50625062
this.wait();
50635063
}

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/lynx-workspace.service.spec.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ describe('LynxWorkspaceService', () => {
190190
return await this.realtimeService.get<TextDoc>(TextDoc.COLLECTION, id, new DocSubscription('spec'));
191191
}
192192

193-
createMockProjectDoc(id: string = PROJECT_ID, lynxConfig?: LynxConfig): Promise<SFProjectProfileDoc> {
193+
async createMockProjectDoc(id: string = PROJECT_ID, lynxConfig?: LynxConfig): Promise<SFProjectProfileDoc> {
194194
const projectData = createTestProjectProfile({
195195
texts: [
196196
{
@@ -273,7 +273,7 @@ describe('LynxWorkspaceService', () => {
273273
}
274274

275275
async triggerProjectChange(id: string, lynxConfig?: LynxConfig): Promise<void> {
276-
this.projectDocTestSubject$.next(this.createMockProjectDoc(id, lynxConfig));
276+
this.projectDocTestSubject$.next(await this.createMockProjectDoc(id, lynxConfig));
277277
tick();
278278
}
279279

@@ -384,7 +384,7 @@ describe('LynxWorkspaceService', () => {
384384
when(mockWorkspaceFactory.createWorkspace(anything(), anything())).thenReturn(workspaceMock as any);
385385

386386
// Set up project and workspace
387-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
387+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
388388
autoCorrectionsEnabled: true,
389389
assessmentsEnabled: true,
390390
punctuationCheckerEnabled: true,
@@ -557,7 +557,7 @@ describe('LynxWorkspaceService', () => {
557557
flush();
558558

559559
// Create project with lynx features enabled so documents will be opened
560-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
560+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
561561
autoCorrectionsEnabled: true,
562562
assessmentsEnabled: true,
563563
punctuationCheckerEnabled: true,
@@ -589,7 +589,7 @@ describe('LynxWorkspaceService', () => {
589589
flush();
590590

591591
// Create project with lynx features enabled so documents will be opened
592-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
592+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
593593
autoCorrectionsEnabled: true,
594594
assessmentsEnabled: true,
595595
punctuationCheckerEnabled: true,
@@ -614,7 +614,7 @@ describe('LynxWorkspaceService', () => {
614614
flush();
615615

616616
// Set up project with lynx features enabled so documents will be opened
617-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
617+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
618618
autoCorrectionsEnabled: true,
619619
assessmentsEnabled: true,
620620
punctuationCheckerEnabled: true,
@@ -646,7 +646,7 @@ describe('LynxWorkspaceService', () => {
646646
flush();
647647

648648
// Set up project with lynx features enabled
649-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
649+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
650650
autoCorrectionsEnabled: false,
651651
assessmentsEnabled: true,
652652
punctuationCheckerEnabled: true,
@@ -677,7 +677,7 @@ describe('LynxWorkspaceService', () => {
677677
flush();
678678

679679
// Set up project with lynx features enabled
680-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
680+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
681681
autoCorrectionsEnabled: false,
682682
assessmentsEnabled: true,
683683
punctuationCheckerEnabled: true,
@@ -716,7 +716,7 @@ describe('LynxWorkspaceService', () => {
716716
flush();
717717

718718
// Set up project with lynx features enabled
719-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
719+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
720720
autoCorrectionsEnabled: false,
721721
assessmentsEnabled: true,
722722
punctuationCheckerEnabled: true,
@@ -746,7 +746,7 @@ describe('LynxWorkspaceService', () => {
746746
flush();
747747

748748
// Set up project with lynx features enabled
749-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
749+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
750750
autoCorrectionsEnabled: false,
751751
assessmentsEnabled: true,
752752
punctuationCheckerEnabled: true,
@@ -780,7 +780,7 @@ describe('LynxWorkspaceService', () => {
780780
flush();
781781

782782
// Set up project with auto-corrections enabled
783-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
783+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
784784
autoCorrectionsEnabled: true,
785785
assessmentsEnabled: false,
786786
punctuationCheckerEnabled: true,
@@ -819,7 +819,7 @@ describe('LynxWorkspaceService', () => {
819819
});
820820

821821
// Set up project with auto-corrections enabled
822-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
822+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
823823
autoCorrectionsEnabled: true,
824824
assessmentsEnabled: false,
825825
punctuationCheckerEnabled: true,
@@ -857,12 +857,12 @@ describe('LynxWorkspaceService', () => {
857857
expect(result).toEqual([]);
858858
}));
859859

860-
it('should return empty array when auto-corrections are disabled', fakeAsync(() => {
860+
it('should return empty array when auto-corrections are disabled', fakeAsync(async () => {
861861
const env = new TestEnvironment();
862862
env.service['textDocId'] = new TextDocId(PROJECT_ID, BOOK_NUM, CHAPTER_NUM);
863863

864864
// Create project with auto-corrections disabled
865-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
865+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
866866
autoCorrectionsEnabled: false,
867867
assessmentsEnabled: false,
868868
punctuationCheckerEnabled: false,
@@ -882,7 +882,7 @@ describe('LynxWorkspaceService', () => {
882882
verify(mockWorkspace.getOnTypeEdits(anything(), anything(), anything())).never();
883883
}));
884884

885-
it('should return edits when auto-corrections are enabled', fakeAsync(() => {
885+
it('should return edits when auto-corrections are enabled', fakeAsync(async () => {
886886
const env = new TestEnvironment();
887887

888888
env.setCustomWorkspaceMock((workspaceMock: any) => {
@@ -892,7 +892,7 @@ describe('LynxWorkspaceService', () => {
892892
});
893893

894894
// Create project with auto-corrections enabled
895-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
895+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
896896
autoCorrectionsEnabled: true,
897897
assessmentsEnabled: false,
898898
punctuationCheckerEnabled: true,
@@ -940,7 +940,7 @@ describe('LynxWorkspaceService', () => {
940940
);
941941
});
942942

943-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
943+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
944944
autoCorrectionsEnabled: true,
945945
assessmentsEnabled: true,
946946
punctuationCheckerEnabled: true,
@@ -985,7 +985,7 @@ describe('LynxWorkspaceService', () => {
985985
flush();
986986

987987
// Set up project with lynx features enabled
988-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
988+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
989989
autoCorrectionsEnabled: false,
990990
assessmentsEnabled: true,
991991
punctuationCheckerEnabled: true,
@@ -1058,7 +1058,7 @@ describe('LynxWorkspaceService', () => {
10581058
flush();
10591059

10601060
// Set up project with lynx features enabled
1061-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
1061+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
10621062
autoCorrectionsEnabled: false,
10631063
assessmentsEnabled: true,
10641064
punctuationCheckerEnabled: true,
@@ -1146,7 +1146,7 @@ describe('LynxWorkspaceService', () => {
11461146
flush();
11471147

11481148
// Set up project with lynx features enabled
1149-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
1149+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
11501150
autoCorrectionsEnabled: false,
11511151
assessmentsEnabled: true,
11521152
punctuationCheckerEnabled: true,
@@ -1238,7 +1238,7 @@ describe('LynxWorkspaceService', () => {
12381238
flush();
12391239

12401240
// Set up project with lynx features enabled
1241-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
1241+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
12421242
autoCorrectionsEnabled: false,
12431243
assessmentsEnabled: true,
12441244
punctuationCheckerEnabled: true,
@@ -1306,7 +1306,7 @@ describe('LynxWorkspaceService', () => {
13061306
flush();
13071307

13081308
// Set up project with lynx features enabled
1309-
const projectDoc = env.createMockProjectDoc(PROJECT_ID, {
1309+
const projectDoc = await env.createMockProjectDoc(PROJECT_ID, {
13101310
autoCorrectionsEnabled: false,
13111311
assessmentsEnabled: true,
13121312
punctuationCheckerEnabled: true,

0 commit comments

Comments
 (0)