diff --git a/src/test/webapp/unit/module/secondary/RestManagementRepository.spec.ts b/src/test/webapp/unit/module/secondary/RestManagementRepository.spec.ts new file mode 100644 index 0000000000..6a88c0a732 --- /dev/null +++ b/src/test/webapp/unit/module/secondary/RestManagementRepository.spec.ts @@ -0,0 +1,34 @@ +import { ManagementInfo } from '@/module/domain/ManagementInfo'; +import { RestManagementRepository } from '@/module/secondary/RestManagementRepository'; +import { describe, expect, it } from 'vitest'; +import { dataBackendResponse, stubAxiosHttp } from '../../http/AxiosHttpStub'; + +describe('Rest management repository', () => { + it('should get info using axios', async () => { + const axiosInstance = stubAxiosHttp(); + const repository = new RestManagementRepository(axiosInstance); + axiosInstance.get.resolves(dataBackendResponse(restManagementInfo())); + + const managementInfo = await repository.getInfo(); + + expect(managementInfo).toEqual(info); + }); +}); + +const info = { + git: { + commit: { + id: { + describe: 'feat(rest): add management info', + abbrev: 'b3f4', + }, + }, + branch: 'main', + build: { + version: '1.2.3', + time: '19:00', + }, + }, +}; + +const restManagementInfo = (): ManagementInfo => info; diff --git a/vitest.config.ts b/vitest.config.ts index 8cbf4ba1f5..39412430bf 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -45,7 +45,6 @@ export default defineConfig({ 'src/main/webapp/app/main.ts', 'src/main/webapp/app/router/index.ts', 'src/main/webapp/app/**/application/*Provider.ts', - 'src/main/webapp/app/module/secondary/RestManagementRepository.ts', 'src/main/webapp/app/injections.ts', '**/*.d.ts', 'src/test/**/*',