Skip to content

Commit

Permalink
test(orm): make the test "custom order by clause" not flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Sep 4, 2024
1 parent 18103ea commit 78bcfb1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions test/orm/model_has_many.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import { test } from '@japa/runner'
import { DateTime } from 'luxon'
import type { HasMany } from '../../src/types/relations.js'

import { scope } from '../../src/orm/base_model/index.js'
Expand Down Expand Up @@ -3716,6 +3717,8 @@ if (process.env.DB !== 'mysql_legacy') {

const [user0, user1] = await db.query().from('users')

const now = DateTime.now()

/**
* User 1
*/
Expand All @@ -3726,27 +3729,27 @@ if (process.env.DB !== 'mysql_legacy') {
{
user_id: user0.id,
title: 'Adonis 101',
created_at: new Date(),
created_at: now,
},
{
user_id: user0.id,
title: 'Adonis 102',
created_at: new Date(),
created_at: now.plus({ seconds: 1 }),
},
{
user_id: user0.id,
title: 'Adonis 103',
created_at: new Date(),
created_at: now.plus({ seconds: 2 }),
},
{
user_id: user0.id,
title: 'Adonis 104',
created_at: new Date(),
created_at: now.plus({ seconds: 3 }),
},
{
user_id: user0.id,
title: 'Adonis 105',
created_at: new Date(),
created_at: now.plus({ seconds: 4 }),
},
])

Expand All @@ -3760,27 +3763,27 @@ if (process.env.DB !== 'mysql_legacy') {
{
user_id: user1.id,
title: 'Lucid 101',
created_at: new Date(),
created_at: now,
},
{
user_id: user1.id,
title: 'Lucid 102',
created_at: new Date(),
created_at: now.plus({ seconds: 1 }),
},
{
user_id: user1.id,
title: 'Lucid 103',
created_at: new Date(),
created_at: now.plus({ seconds: 2 }),
},
{
user_id: user1.id,
title: 'Lucid 104',
created_at: new Date(),
created_at: now.plus({ seconds: 3 }),
},
{
user_id: user1.id,
title: 'Lucid 105',
created_at: new Date(),
created_at: now.plus({ seconds: 4 }),
},
])

Expand Down

0 comments on commit 78bcfb1

Please sign in to comment.