1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-04-15 20:46:26 +02:00
immich/server/libs/common/src/utils/user-utils.spec.ts
Jason Rasmussen 131caa20eb
refactor(server): domain/infra ()
* refactor: user repository

* refactor: user module

* refactor: move database into infra

* refactor(cli): use user core

* chore: import path

* chore: tests
2023-01-11 21:34:36 -05:00

19 lines
667 B
TypeScript

// create unit test for user utils
import { UserEntity } from '@app/infra';
import { userUtils } from './user-utils';
describe('User Utilities', () => {
describe('checkIsReadyForDeletion', () => {
it('check that user is not ready to be deleted', () => {
const result = userUtils.isReadyForDeletion({ deletedAt: new Date() } as UserEntity);
expect(result).toBeFalsy();
});
it('check that user is ready to be deleted', () => {
const aWeekAgo = new Date(new Date().getTime() - 8 * 86400000);
const result = userUtils.isReadyForDeletion({ deletedAt: aWeekAgo } as UserEntity);
expect(result).toBeTruthy();
});
});
});