mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): version logic (#9615)
* refactor(server): version * test: better version and log checks
This commit is contained in:
parent
5f25f28c42
commit
1df7be8436
19 changed files with 404 additions and 509 deletions
|
|
@ -14,10 +14,10 @@ import { newServerInfoRepositoryMock } from 'test/repositories/system-info.repos
|
|||
import { newSystemMetadataRepositoryMock } from 'test/repositories/system-metadata.repository.mock';
|
||||
import { Mocked } from 'vitest';
|
||||
|
||||
const mockRelease = (version = '100.0.0') => ({
|
||||
const mockRelease = (version: string) => ({
|
||||
id: 1,
|
||||
url: 'https://api.github.com/repos/owner/repo/releases/1',
|
||||
tag_name: 'v' + version,
|
||||
tag_name: version,
|
||||
name: 'Release 1000',
|
||||
created_at: DateTime.utc().toISO(),
|
||||
published_at: DateTime.utc().toISO(),
|
||||
|
|
@ -48,7 +48,11 @@ describe(VersionService.name, () => {
|
|||
|
||||
describe('getVersion', () => {
|
||||
it('should respond the server version', () => {
|
||||
expect(sut.getVersion()).toEqual(serverVersion);
|
||||
expect(sut.getVersion()).toEqual({
|
||||
major: serverVersion.major,
|
||||
minor: serverVersion.minor,
|
||||
patch: serverVersion.patch,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -78,7 +82,7 @@ describe(VersionService.name, () => {
|
|||
});
|
||||
|
||||
it('should run if it has been > 60 minutes', async () => {
|
||||
serverMock.getGitHubRelease.mockResolvedValue(mockRelease());
|
||||
serverMock.getGitHubRelease.mockResolvedValue(mockRelease('v100.0.0'));
|
||||
systemMock.get.mockResolvedValue({
|
||||
checkedAt: DateTime.utc().minus({ minutes: 65 }).toISO(),
|
||||
releaseVersion: '1.0.0',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue