Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
test(application serve): get AppImage information
Browse files Browse the repository at this point in the history
  • Loading branch information
Messias Junior authored and MessiasLima committed Apr 19, 2021
1 parent 1ab3a46 commit f45e50e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/app/service/application/application.service.spec.ts
Expand Up @@ -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;
Expand All @@ -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];
Expand Down Expand Up @@ -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);
});
});

0 comments on commit f45e50e

Please sign in to comment.