mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: cli e2e (#7211)
This commit is contained in:
parent
870d517ce3
commit
947bcf2d68
26 changed files with 442 additions and 500 deletions
|
|
@ -1,26 +0,0 @@
|
|||
import { spawn, exec } from 'child_process';
|
||||
|
||||
export default async () => {
|
||||
let _resolve: () => unknown;
|
||||
const promise = new Promise<void>((resolve, reject) => (_resolve = resolve));
|
||||
|
||||
const child = spawn('docker', ['compose', 'up'], { stdio: 'pipe' });
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
const input = data.toString();
|
||||
console.log(input);
|
||||
if (input.includes('Immich Server is listening')) {
|
||||
_resolve();
|
||||
}
|
||||
});
|
||||
|
||||
child.stderr.on('data', (data) => console.log(data.toString()));
|
||||
|
||||
await promise;
|
||||
|
||||
return async () => {
|
||||
await new Promise<void>((resolve) =>
|
||||
exec('docker compose down', () => resolve())
|
||||
);
|
||||
};
|
||||
};
|
||||
|
|
@ -11,15 +11,15 @@ import {
|
|||
loginResponseDto,
|
||||
signupResponseDto,
|
||||
} from 'src/responses';
|
||||
import { app, asAuthHeader, dbUtils } from 'src/utils';
|
||||
import { apiUtils, app, asBearerAuth, dbUtils } from 'src/utils';
|
||||
import request from 'supertest';
|
||||
import { beforeAll, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
const { name, email, password } = signupDto.admin;
|
||||
|
||||
describe(`Registration`, () => {
|
||||
describe(`/auth/admin-sign-up`, () => {
|
||||
beforeAll(() => {
|
||||
dbUtils.setup();
|
||||
apiUtils.setup();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
|
|
@ -96,7 +96,7 @@ describe(`Registration`, () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Auth', () => {
|
||||
describe('/auth/*', () => {
|
||||
let admin: LoginResponseDto;
|
||||
|
||||
beforeEach(async () => {
|
||||
|
|
@ -177,7 +177,7 @@ describe('Auth', () => {
|
|||
}
|
||||
|
||||
await expect(
|
||||
getAuthDevices({ headers: asAuthHeader(admin.accessToken) })
|
||||
getAuthDevices({ headers: asBearerAuth(admin.accessToken) })
|
||||
).resolves.toHaveLength(6);
|
||||
|
||||
const { status } = await request(app)
|
||||
|
|
@ -186,7 +186,7 @@ describe('Auth', () => {
|
|||
expect(status).toBe(204);
|
||||
|
||||
await expect(
|
||||
getAuthDevices({ headers: asAuthHeader(admin.accessToken) })
|
||||
getAuthDevices({ headers: asBearerAuth(admin.accessToken) })
|
||||
).resolves.toHaveLength(1);
|
||||
});
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ describe('Auth', () => {
|
|||
|
||||
it('should logout a device', async () => {
|
||||
const [device] = await getAuthDevices({
|
||||
headers: asAuthHeader(admin.accessToken),
|
||||
headers: asBearerAuth(admin.accessToken),
|
||||
});
|
||||
const { status } = await request(app)
|
||||
.delete(`/auth/devices/${device.id}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue