From f45e50ef6b2f75e385b62e865da100687a24b1ed Mon Sep 17 00:00:00 2001 From: Messias Junior Date: Mon, 19 Apr 2021 21:31:13 +0100 Subject: [PATCH] test(application serve): get AppImage information --- .../application/application.service.spec.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/app/service/application/application.service.spec.ts b/src/app/service/application/application.service.spec.ts index b307c41..0089025 100644 --- a/src/app/service/application/application.service.spec.ts +++ b/src/app/service/application/application.service.spec.ts @@ -9,6 +9,7 @@ import { of } from 'rxjs'; import { ProcessInfo } from '../process/process-info'; import { ProcessStatus } from '../process/process'; import { AppImageService } from '../appimage/app-image.service'; +import * as PackageType from '../../../../core/model/PackageType'; describe('ApplicationService', () => { let service: ApplicationService; @@ -24,7 +25,9 @@ describe('ApplicationService', () => { uninstallApplication: jest.fn(), }; - const mockAppImageService = {}; + const mockAppImageService = { + getAppImageInformation: jest.fn(), + }; const mockApplication: Application = { id: '1', name: 'Application' }; const mockedApps: Application[] = [mockApplication]; @@ -155,4 +158,21 @@ describe('ApplicationService', () => { mockProcessService.uninstallApplication.mock.calls[0][0], ).toEqual(mockApplication); }); + + it('should get app image information', async () => { + const mockApp: Application = { + id: '1', + name: 'Application', + packageType: PackageType.APP_IMAGE, + }; + + mockCoreService.invoke.mockReturnValue(Promise.resolve(mockApp)); + mockAppImageService.getAppImageInformation.mockReturnValue( + Promise.resolve(mockApp), + ); + + const result = await service.findById(mockApp.id); + + expect(result).toEqual(mockApp); + }); });