Fix issue with saving project files (#509)
* Fixed issue with saving project file * Fixed unit test for project service
This commit is contained in:
Родитель
6d97cef60e
Коммит
ae7dc90d4d
|
@ -45,7 +45,12 @@ describe("Project Service", () => {
|
|||
it("Saves calls project storage provider to write project", async () => {
|
||||
const result = await projectSerivce.save(testProject, securityToken);
|
||||
|
||||
const encryptedProject: IProject = { ...testProject };
|
||||
const encryptedProject: IProject = {
|
||||
...testProject,
|
||||
sourceConnection: { ...testProject.sourceConnection },
|
||||
targetConnection: { ...testProject.targetConnection },
|
||||
exportFormat: { ...testProject.exportFormat },
|
||||
};
|
||||
encryptedProject.sourceConnection.providerOptions = {
|
||||
encrypted: expect.any(String),
|
||||
};
|
||||
|
|
|
@ -56,7 +56,6 @@ export default class ProjectService implements IProjectService {
|
|||
const storageProvider = StorageProviderFactory.createFromConnection(project.targetConnection);
|
||||
await this.saveExportSettings(project);
|
||||
project = encryptProject(project, securityToken);
|
||||
await this.saveProjectFile(project);
|
||||
|
||||
await storageProvider.writeText(
|
||||
`${project.name}${constants.projectFileExtension}`,
|
||||
|
@ -116,15 +115,4 @@ export default class ProjectService implements IProjectService {
|
|||
|
||||
project.exportFormat.providerOptions = await exportProvider.save(project.exportFormat);
|
||||
}
|
||||
|
||||
private async saveProjectFile(project: IProject): Promise<void> {
|
||||
const storageProvider = StorageProviderFactory.create(
|
||||
project.targetConnection.providerType,
|
||||
project.targetConnection.providerOptions,
|
||||
);
|
||||
|
||||
await storageProvider.writeText(
|
||||
`${project.name}${constants.projectFileExtension}`,
|
||||
JSON.stringify(project, null, 4));
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче