Skip to content

Commit d364692

Browse files
committed
chore: lint test files
1 parent 38ffa23 commit d364692

15 files changed

+42
-144
lines changed

test/feature/model/Delete.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ describe('Feature - Model - Delete', () => {
283283

284284
await User.insert({ data: { id: 1, posts: [{ id: 2 }, { id: 3 }] } })
285285

286-
const user = User.query()
287-
.with('posts')
288-
.find(1) as User
286+
const user = User.query().with('posts').find(1) as User
289287

290288
expect(user.$isDeleted).toBe(false)
291289
expect(user.deleted_at).toBe(null)
@@ -337,9 +335,7 @@ describe('Feature - Model - Delete', () => {
337335
data: { id: 1, name: 'John Doe', post: [{ id: 2 }, { id: 3 }] }
338336
})
339337

340-
const user = User.query()
341-
.with('post')
342-
.find(1) as User
338+
const user = User.query().with('post').find(1) as User
343339

344340
expect(user.name).toBe('John Doe')
345341
expect(user.post).toBeInstanceOf(Post)

test/feature/model/Deprecated.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ describe('Feature - Model - Deprecated', () => {
8989

9090
await User.softDelete(1)
9191

92-
const users = User.query()
93-
.trashed()
94-
.get()
92+
const users = User.query().trashed().get()
9593

9694
expect(spyOnWarn).toHaveBeenCalled()
9795
expect(users.length).toBe(1)

test/feature/model/Restore.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ describe('Feature - Model - Restore', () => {
111111
}
112112
})
113113

114-
const user = User.query()
115-
.with('post')
116-
.find(1) as User
114+
const user = User.query().with('post').find(1) as User
117115

118116
expect(user.$isDeleted).toBe(true)
119117
expect(user.deleted_at).toBe(mockDate)
@@ -171,9 +169,7 @@ describe('Feature - Model - Restore', () => {
171169
}
172170
})
173171

174-
const user = User.query()
175-
.with('post')
176-
.find(1) as User
172+
const user = User.query().with('post').find(1) as User
177173

178174
expect(user.$isDeleted).toBe(true)
179175
expect(user.deleted_at).toBe(mockDate)

test/feature/model/Retrieve.spec.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ describe('Feature - Model - Retrieve', () => {
3737

3838
await User.softDelete(1)
3939

40-
const users = User.query()
41-
.withTrashed()
42-
.get()
40+
const users = User.query().withTrashed().get()
4341

4442
expect(users.length).toBe(3)
4543
expect(users[0].$isDeleted).toBe(true)
@@ -52,9 +50,7 @@ describe('Feature - Model - Retrieve', () => {
5250

5351
await User.softDelete(1)
5452

55-
const users = User.query()
56-
.onlyTrashed()
57-
.get()
53+
const users = User.query().onlyTrashed().get()
5854

5955
expect(users.length).toBe(1)
6056
expect(users[0].id).toBe(1)
@@ -92,15 +88,11 @@ describe('Feature - Model - Retrieve', () => {
9288

9389
await User.softDelete(1)
9490

95-
const user = User.query()
96-
.whereId(1)
97-
.first()
91+
const user = User.query().whereId(1).first()
9892

9993
expect(user).toBe(null)
10094

101-
const users = User.query()
102-
.whereIdIn([1, 2])
103-
.get()
95+
const users = User.query().whereIdIn([1, 2]).get()
10496

10597
expect(users.length).toBe(1)
10698
expect(users[0].$isDeleted).toBe(false)
@@ -111,9 +103,7 @@ describe('Feature - Model - Retrieve', () => {
111103

112104
await User.softDelete(1)
113105

114-
const users = User.query()
115-
.withTrashed()
116-
.get()
106+
const users = User.query().withTrashed().get()
117107

118108
expect(users.length).toBe(2)
119109
expect(users[0].$trashed()).toBe(true)

test/feature/relations/BelongsTo.spec.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,15 @@ describe('Feature - Relations - Belongs To', () => {
4040
it('can resolve queries without deleted relations (default)', async () => {
4141
await User.softDelete(1)
4242

43-
const post = Post.query()
44-
.with('user')
45-
.find(1) as Post
43+
const post = Post.query().with('user').find(1) as Post
4644

4745
expect(post.user).toBeNull()
4846
})
4947

5048
it('can include deleted relations using `withTrashed` clause', async () => {
5149
await User.softDelete(1)
5250

53-
const post = Post.query()
54-
.withTrashed()
55-
.with('user')
56-
.find(1) as Post
51+
const post = Post.query().withTrashed().with('user').find(1) as Post
5752

5853
expect(post.user).toBeInstanceOf(User)
5954
expect(post.user.$trashed()).toBe(true)
@@ -62,10 +57,7 @@ describe('Feature - Relations - Belongs To', () => {
6257
it('can resolve only deleted relations using `onlyTrashed` clause', async () => {
6358
await User.softDelete(1)
6459

65-
const post = Post.query()
66-
.onlyTrashed()
67-
.with('user')
68-
.find(1) as Post
60+
const post = Post.query().onlyTrashed().with('user').find(1) as Post
6961

7062
expect(post.user).toBeInstanceOf(User)
7163
expect(post.user.$trashed()).toBe(true)

test/feature/relations/BelongsToMany.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ describe('Feature - Relations - Belongs To Many', () => {
5252
it('can resolve queries without deleted relation (default)', async () => {
5353
await Role.softDelete(3)
5454

55-
const users = User.query()
56-
.with('roles')
57-
.findIn([1, 2]) as User[]
55+
const users = User.query().with('roles').findIn([1, 2]) as User[]
5856

5957
expect(users[0].roles.length).toBe(1)
6058
expect(users[0].roles[0].$trashed()).toBe(false)

test/feature/relations/HasMany.spec.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ describe('Feature - Relations - Has Many', () => {
4040
it('can resolve queries without deleted relations (default)', async () => {
4141
await Post.softDelete(1)
4242

43-
const user = User.query()
44-
.with('posts')
45-
.find(1) as User
43+
const user = User.query().with('posts').find(1) as User
4644

4745
expect(user.posts.length).toBe(1)
4846
expect(user.posts[0].$trashed()).toBe(false)
@@ -51,10 +49,7 @@ describe('Feature - Relations - Has Many', () => {
5149
it('can include deleted relations using `withTrashed` clause', async () => {
5250
await Post.softDelete(1)
5351

54-
const user = User.query()
55-
.withTrashed()
56-
.with('posts')
57-
.find(1) as User
52+
const user = User.query().withTrashed().with('posts').find(1) as User
5853

5954
expect(user.posts.length).toBe(2)
6055
expect(user.posts[0].$trashed()).toBe(true)
@@ -64,10 +59,7 @@ describe('Feature - Relations - Has Many', () => {
6459
it('can resolve only deleted relations using `onlyTrashed` clause', async () => {
6560
await Post.softDelete(1)
6661

67-
const user = User.query()
68-
.onlyTrashed()
69-
.with('posts')
70-
.find(1) as User
62+
const user = User.query().onlyTrashed().with('posts').find(1) as User
7163

7264
expect(user.posts.length).toBe(1)
7365
expect(user.posts[0].$trashed()).toBe(true)

test/feature/relations/HasManyBy.spec.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ describe('Feature - Relations - Has Many By', () => {
4040
it('can resolve queries without deleted relations (default)', async () => {
4141
await Post.softDelete(2)
4242

43-
const user = User.query()
44-
.with('posts')
45-
.find(1) as User
43+
const user = User.query().with('posts').find(1) as User
4644

4745
expect(user.posts.length).toBe(1)
4846
expect(user.posts[0].$trashed()).toBe(false)
@@ -51,10 +49,7 @@ describe('Feature - Relations - Has Many By', () => {
5149
it('can include deleted relations using `withTrashed` clause', async () => {
5250
await Post.softDelete(2)
5351

54-
const user = User.query()
55-
.withTrashed()
56-
.with('posts')
57-
.find(1) as User
52+
const user = User.query().withTrashed().with('posts').find(1) as User
5853

5954
expect(user.posts.length).toBe(2)
6055
expect(user.posts[0].$trashed()).toBe(true)
@@ -64,10 +59,7 @@ describe('Feature - Relations - Has Many By', () => {
6459
it('can resolve only deleted relations using `onlyTrashed` clause', async () => {
6560
await Post.softDelete(2)
6661

67-
const user = User.query()
68-
.onlyTrashed()
69-
.with('posts')
70-
.find(1) as User
62+
const user = User.query().onlyTrashed().with('posts').find(1) as User
7163

7264
expect(user.posts.length).toBe(1)
7365
expect(user.posts[0].$trashed()).toBe(true)

test/feature/relations/HasManyThrough.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ describe('Feature - Relations - Has Many Through', () => {
6262
it('can resolve queries without deleted relations (default)', async () => {
6363
await Post.softDelete(1)
6464

65-
const country = Country.query()
66-
.with('posts')
67-
.find(1) as Country
65+
const country = Country.query().with('posts').find(1) as Country
6866

6967
expect(country.posts.length).toBe(1)
7068
expect(country.posts[0].$trashed()).toBe(false)

test/feature/relations/HasOne.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ describe('Feature - Relations - Has One', () => {
4040
it('can resolve queries without deleted relations (default)', async () => {
4141
await Post.softDelete(3)
4242

43-
const users = User.query()
44-
.with('post')
45-
.findIn([1, 2]) as User[]
43+
const users = User.query().with('post').findIn([1, 2]) as User[]
4644

4745
expect(users[0].post).toBeNull()
4846
expect(users[1].post).toBeInstanceOf(Post)

0 commit comments

Comments
 (0)