From 8f066595fc472b318d16a111958baa5628e50361 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 23 Nov 2021 11:49:06 +0100 Subject: [PATCH] factory for login user backup --- .../src/factories/login-user-backup.factory.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 database/src/factories/login-user-backup.factory.ts diff --git a/database/src/factories/login-user-backup.factory.ts b/database/src/factories/login-user-backup.factory.ts new file mode 100644 index 000000000..35363263e --- /dev/null +++ b/database/src/factories/login-user-backup.factory.ts @@ -0,0 +1,18 @@ +import Faker from 'faker' +import { define } from 'typeorm-seeding' +import { LoginUserBackup } from '../../entity/LoginUserBackup' + +interface LoginUserBackupContext { + passphrase?: string + mnemonicType?: number +} + +define(LoginUserBackup, (faker: typeof Faker, context?: LoginUserBackupContext) => { + if (!context) context = {} + + const userBackup = new LoginUserBackup() + userBackup.passphrase = context.passphrase ? context.passphrase : faker.random.words(24) + userBackup.mnemonicType = context.mnemonicType ? context.mnemonicType : 2 + + return userBackup +})