mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fixing failing test
This commit is contained in:
parent
0814970a9c
commit
af4f15c5aa
@ -103,24 +103,26 @@ describe("column kinds > update date column", () => {
|
||||
await postRepository.save(post)
|
||||
|
||||
// load to get updated date we had after first save
|
||||
const loadedPostBeforeUpdate = await postRepository.findOneBy({
|
||||
id: post.id,
|
||||
})
|
||||
const loadedPostBeforeUpdate =
|
||||
await postRepository.findOneByOrFail({
|
||||
id: post.id,
|
||||
})
|
||||
|
||||
// wait a second
|
||||
await sleep(1000)
|
||||
await sleep(2000)
|
||||
|
||||
// update post once again
|
||||
post.title = "Updated Title"
|
||||
await postRepository.save(post)
|
||||
|
||||
// check if date was updated
|
||||
const loadedPostAfterUpdate = await postRepository.findOneBy({
|
||||
id: post.id,
|
||||
})
|
||||
expect(
|
||||
loadedPostAfterUpdate!.updatedAt.toString(),
|
||||
).to.be.not.eql(loadedPostBeforeUpdate!.updatedAt.toString())
|
||||
const loadedPostAfterUpdate =
|
||||
await postRepository.findOneByOrFail({
|
||||
id: post.id,
|
||||
})
|
||||
expect(loadedPostAfterUpdate.updatedAt.getTime()).to.be.not.eql(
|
||||
loadedPostBeforeUpdate.updatedAt.getTime(),
|
||||
)
|
||||
}),
|
||||
))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user