Skip to content

Commit 91f9bc0

Browse files
committed
test(adapter): Remove address field from the tests and make it optional
1 parent dd2db54 commit 91f9bc0

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

tests/fixtures/entities/defaults/User.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export class User extends Base implements DatabaseUser {
2828
@OneToMany(() => Session, "user")
2929
sessions = new Collection<Session, this>(this)
3030

31-
@Embedded(() => Address, {object: true})
32-
address!: Address
31+
@Embedded(() => Address, {object: true, nullable: true})
32+
address?: Address
3333
}

tests/fixtures/randomUsers.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,7 @@ export function createRandomUsersUtils(orm: MikroORM): RandomUserUtils {
3535
const name = [firstName, lastName].join(" ")
3636
const email = faker.internet.email({firstName, lastName})
3737

38-
return {
39-
email,
40-
name,
41-
address: {
42-
street: faker.location.streetAddress(),
43-
city: faker.location.city()
44-
}
45-
}
38+
return {email, name}
4639
}
4740

4841
const createMany: CreateManyUsers = (amount, cb) =>

tests/utils/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
export interface UserInput {
2-
email: string
3-
name: string
4-
address: AddressInput
5-
}
6-
71
export interface AddressInput {
82
street: string
93
city: string
104
}
115

6+
export interface UserInput {
7+
email: string
8+
name: string
9+
address?: AddressInput
10+
}
11+
1212
export interface SessionInput {
1313
token: string
1414
userId: string

0 commit comments

Comments
 (0)