chore(server): improve e2e test speed (#5026)

* feat: improve shared link (41s to 8s)

* feat: improve activity (18s to 8s)

* feat: improve partner (20s to 10s)

* feat: improve server-info (10s to 6s)

* feat: improve system-config

* fix: e2e

* chore: linting
This commit is contained in:
Jason Rasmussen 2023-11-14 20:08:22 -05:00 committed by GitHub
parent 6214d510d6
commit 6127fd4c5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 307 additions and 226 deletions

View file

@ -7,6 +7,24 @@ import request from 'supertest';
type UploadDto = Partial<CreateAssetDto> & { content?: Buffer };
export const assetApi = {
create: async (
server: any,
accessToken: string,
dto: Omit<CreateAssetDto, 'assetData'>,
): Promise<AssetResponseDto> => {
const { status, body } = await request(server)
.post(`/asset/upload`)
.field('deviceAssetId', dto.deviceAssetId)
.field('deviceId', dto.deviceId)
.field('fileCreatedAt', dto.fileCreatedAt.toISOString())
.field('fileModifiedAt', dto.fileModifiedAt.toISOString())
.attach('assetData', randomBytes(32), 'example.jpg')
.set('Authorization', `Bearer ${accessToken}`);
expect([200, 201].includes(status)).toBe(true);
return body as AssetResponseDto;
},
get: async (server: any, accessToken: string, id: string): Promise<AssetResponseDto> => {
const { body, status } = await request(server)
.get(`/asset/assetById/${id}`)