This commit is contained in:
Jonathan Jogenfors 2023-11-17 11:59:18 +01:00
parent 9ba8565730
commit 36e8397ce2
6 changed files with 14 additions and 19 deletions

View file

@ -1,5 +1,4 @@
import { ImmichApi } from '../api/client';
import path from 'node:path';
import { SessionService } from '../services/session.service';
import { LoginError } from '../cores/errors/login-error';
import { exit } from 'node:process';

View file

@ -28,8 +28,7 @@ describe('SessionService', () => {
});
beforeEach(() => {
const configDir = '/config';
sessionService = new SessionService(configDir);
sessionService = new SessionService();
});
it('should connect to immich', async () => {

View file

@ -3,7 +3,6 @@ import yaml from 'yaml';
import path from 'node:path';
import { ImmichApi } from '../api/client';
import { LoginError } from '../cores/errors/login-error';
import { config } from 'node:process';
import os from 'os';
export class SessionService {
@ -11,12 +10,16 @@ export class SessionService {
readonly authPath!: string;
private api!: ImmichApi;
constructor() {
const configDir = process.env.IMMICH_CONFIG_DIR;
constructor(configDir?: string) {
if (!configDir) {
const userHomeDir = os.homedir();
this.configDir = path.join(userHomeDir, '.config/immich/');
configDir = process.env.IMMICH_CONFIG_DIR;
if (!configDir) {
const userHomeDir = os.homedir();
this.configDir = path.join(userHomeDir, '.config/immich/');
} else {
this.configDir = configDir;
}
} else {
this.configDir = configDir;
}

View file

@ -1,11 +1,5 @@
import {
APIKeyCreateResponseDto,
AuthDeviceResponseDto,
LoginCredentialDto,
LoginResponseDto,
UserResponseDto,
} from '@app/domain';
import { adminSignupStub, apiKeyCreateStub, loginResponseStub, loginStub } from '@test';
import { APIKeyCreateResponseDto } from '@app/domain';
import { apiKeyCreateStub } from '@test';
import request from 'supertest';
export const apiKeyApi = {

View file

@ -13,7 +13,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
let admin: LoginResponseDto;
beforeAll(async () => {
server = await testApp.create({ jobs: true, listen: false });
[server] = await testApp.create({ jobs: true });
});
afterAll(async () => {

View file

@ -79,7 +79,7 @@ export const testApp = {
.compile();
app = await moduleFixture.createNestApplication().init();
app.listen(0);
await app.listen(0);
if (jobs) {
await app.get(AppService).init();