Skip to content

Commit

Permalink
Generator: add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Sep 22, 2024
1 parent d84c071 commit 7460cfe
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { dataBackendResponse, stubAxiosHttp } from '../../http/AxiosHttpStub';
import { describe, expect, it } from 'vitest';
import { RestManagementRepository } from '@/module/secondary/RestManagementRepository';
import { ManagementInfo } from '@/module/domain/ManagementInfo';

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;
1 change: 0 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default defineConfig({
'src/main/webapp/app/router/index.ts',
'src/main/webapp/app/**/application/*Provider.ts',
'src/main/webapp/app/shared/alert/infrastructure/primary/WindowApplicationListener.ts',
'src/main/webapp/app/module/secondary/RestManagementRepository.ts',
'src/main/webapp/app/injections.ts',
'**/*.d.ts',
'src/test/**/*',
Expand Down

0 comments on commit 7460cfe

Please sign in to comment.