Fix issue with saving project files (#509)

* Fixed issue with saving project file

* Fixed unit test for project service
This commit is contained in:
Wallace Breza 2019-01-25 15:19:55 -08:00 коммит произвёл GitHub
Родитель 6d97cef60e
Коммит ae7dc90d4d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 13 удалений

Просмотреть файл

@ -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));
}
}