-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/test/webapp/unit/module/secondary/RestManagementRepository.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters