mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 10:37:11 -04:00 
			
		
		
		
	chore: remove unused test util methods (#6689)
* chore: remove unused test util methods * format
This commit is contained in:
		
							parent
							
								
									7404688622
								
							
						
					
					
						commit
						5cec8d1c63
					
				| @ -1,14 +1,12 @@ | |||||||
| import { AssetCreate, IJobRepository, JobItem, JobItemHandler, LibraryResponseDto, QueueName } from '@app/domain'; | import { IJobRepository, JobItem, JobItemHandler, QueueName } from '@app/domain'; | ||||||
| import { AppModule } from '@app/immich'; | import { AppModule } from '@app/immich'; | ||||||
| import { InfraModule, InfraTestModule, dataSource } from '@app/infra'; | import { InfraModule, InfraTestModule, dataSource } from '@app/infra'; | ||||||
| import { AssetEntity, AssetType, LibraryType } from '@app/infra/entities'; |  | ||||||
| import { INestApplication } from '@nestjs/common'; | import { INestApplication } from '@nestjs/common'; | ||||||
| import { Test } from '@nestjs/testing'; | import { Test } from '@nestjs/testing'; | ||||||
| import { randomBytes } from 'crypto'; |  | ||||||
| import * as fs from 'fs'; |  | ||||||
| import { DateTime } from 'luxon'; | import { DateTime } from 'luxon'; | ||||||
| import path from 'path'; | import * as fs from 'node:fs'; | ||||||
| import { Server } from 'tls'; | import path from 'node:path'; | ||||||
|  | import { Server } from 'node:tls'; | ||||||
| import { EntityTarget, ObjectLiteral } from 'typeorm'; | import { EntityTarget, ObjectLiteral } from 'typeorm'; | ||||||
| import { AppService } from '../../src/microservices/app.service'; | import { AppService } from '../../src/microservices/app.service'; | ||||||
| 
 | 
 | ||||||
| @ -121,37 +119,3 @@ export async function restoreTempFolder(): Promise<void> { | |||||||
|   // Create temp folder
 |   // Create temp folder
 | ||||||
|   await fs.promises.mkdir(IMMICH_TEST_ASSET_TEMP_PATH); |   await fs.promises.mkdir(IMMICH_TEST_ASSET_TEMP_PATH); | ||||||
| } | } | ||||||
| 
 |  | ||||||
| function randomDate(start: Date, end: Date): Date { |  | ||||||
|   return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| let assetCount = 0; |  | ||||||
| export function generateAsset( |  | ||||||
|   userId: string, |  | ||||||
|   libraries: LibraryResponseDto[], |  | ||||||
|   other: Partial<AssetEntity> = {}, |  | ||||||
| ): AssetCreate { |  | ||||||
|   const id = assetCount++; |  | ||||||
|   const { fileCreatedAt = randomDate(new Date(1970, 1, 1), new Date(2023, 1, 1)) } = other; |  | ||||||
| 
 |  | ||||||
|   return { |  | ||||||
|     createdAt: today.toJSDate(), |  | ||||||
|     updatedAt: today.toJSDate(), |  | ||||||
|     ownerId: userId, |  | ||||||
|     checksum: randomBytes(20), |  | ||||||
|     originalPath: `/tests/test_${id}`, |  | ||||||
|     deviceAssetId: `test_${id}`, |  | ||||||
|     deviceId: 'e2e-test', |  | ||||||
|     libraryId: ( |  | ||||||
|       libraries.find(({ ownerId, type }) => ownerId === userId && type === LibraryType.UPLOAD) as LibraryResponseDto |  | ||||||
|     ).id, |  | ||||||
|     isVisible: true, |  | ||||||
|     fileCreatedAt, |  | ||||||
|     fileModifiedAt: new Date(), |  | ||||||
|     localDateTime: fileCreatedAt, |  | ||||||
|     type: AssetType.IMAGE, |  | ||||||
|     originalFileName: `test_${id}`, |  | ||||||
|     ...other, |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user