Skip to content

Commit d20477d

Browse files
committed
SF-3567 Add frontend service
1 parent bac5e3d commit d20477d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/core/sf-project.service.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ describe('SFProjectService', () => {
7474
}));
7575
});
7676

77+
describe('onlineApplyPreTranslationToProject', () => {
78+
it('should invoke the command service', fakeAsync(async () => {
79+
const env = new TestEnvironment();
80+
const projectId = 'project01';
81+
const scriptureRange = 'GEN-REV';
82+
const targetProjectId = 'project01';
83+
const timestamp = new Date();
84+
await env.service.onlineApplyPreTranslationToProject(projectId, scriptureRange, targetProjectId, timestamp);
85+
verify(mockedCommandService.onlineInvoke(anything(), 'applyPreTranslationToProject', anything())).once();
86+
expect().nothing();
87+
}));
88+
});
89+
7790
class TestEnvironment {
7891
readonly httpTestingController: HttpTestingController;
7992
readonly service: SFProjectService;

src/SIL.XForge.Scripture/ClientApp/src/app/core/sf-project.service.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,20 @@ export class SFProjectService extends ProjectService<SFProject, SFProjectDoc> {
180180
return this.onlineInvoke('cancelSync', { projectId: id });
181181
}
182182

183+
onlineApplyPreTranslationToProject(
184+
projectId: string,
185+
scriptureRange: string,
186+
targetProjectId: string,
187+
timestamp: Date
188+
): Promise<void> {
189+
return this.onlineInvoke<void>('applyPreTranslationToProject', {
190+
projectId,
191+
scriptureRange,
192+
targetProjectId,
193+
timestamp: timestamp.toISOString()
194+
});
195+
}
196+
183197
onlineSetPreTranslate(projectId: string, preTranslate: boolean): Promise<void> {
184198
return this.onlineInvoke<void>('setPreTranslate', {
185199
projectId,

0 commit comments

Comments
 (0)