Skip to content

Fix all date constructors to Date(0) to prevent test flakiness #4010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions test/server/migrations/v2.15.0-series-column-unique.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ describe('migration-v2.15.0-series-column-unique', () => {
it('upgrade with no duplicate series', async () => {
// Add some entries to the Series table using the UUID for the ids
await queryInterface.bulkInsert('Series', [
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series2Id, name: 'Series 2', libraryId: library2Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series3Id, name: 'Series 3', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() }
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series2Id, name: 'Series 2', libraryId: library2Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series3Id, name: 'Series 3', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
])
// Add some entries to the BookSeries table
await queryInterface.bulkInsert('BookSeries', [
Expand Down Expand Up @@ -126,9 +126,9 @@ describe('migration-v2.15.0-series-column-unique', () => {
it('upgrade with duplicate series and no sequence', async () => {
// Add some entries to the Series table using the UUID for the ids
await queryInterface.bulkInsert('Series', [
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series2Id, name: 'Series 2', libraryId: library2Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series3Id, name: 'Series 3', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series2Id, name: 'Series 2', libraryId: library2Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series3Id, name: 'Series 3', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series1Id_dup, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series3Id_dup, name: 'Series 3', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series1Id_dup2, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
Expand Down Expand Up @@ -172,8 +172,8 @@ describe('migration-v2.15.0-series-column-unique', () => {
it('upgrade with same series name in different libraries', async () => {
// Add some entries to the Series table using the UUID for the ids
await queryInterface.bulkInsert('Series', [
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series2Id, name: 'Series 1', libraryId: library2Id, createdAt: new Date(), updatedAt: new Date() }
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series2Id, name: 'Series 1', libraryId: library2Id, createdAt: new Date(0), updatedAt: new Date(0) }
])
// Add some entries to the BookSeries table
await queryInterface.bulkInsert('BookSeries', [
Expand Down Expand Up @@ -203,8 +203,8 @@ describe('migration-v2.15.0-series-column-unique', () => {
it('upgrade with one book in two of the same series, both sequence are null', async () => {
// Create two different series with the same name in the same library
await queryInterface.bulkInsert('Series', [
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() }
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
])
// Create a book that is in both series
await queryInterface.bulkInsert('BookSeries', [
Expand Down Expand Up @@ -236,8 +236,8 @@ describe('migration-v2.15.0-series-column-unique', () => {
it('upgrade with one book in two of the same series, one sequence is null', async () => {
// Create two different series with the same name in the same library
await queryInterface.bulkInsert('Series', [
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() }
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
])
// Create a book that is in both series
await queryInterface.bulkInsert('BookSeries', [
Expand Down Expand Up @@ -268,8 +268,8 @@ describe('migration-v2.15.0-series-column-unique', () => {
it('upgrade with one book in two of the same series, both sequence are not null', async () => {
// Create two different series with the same name in the same library
await queryInterface.bulkInsert('Series', [
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() },
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(), updatedAt: new Date() }
{ id: series1Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) },
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
])
// Create a book that is in both series
await queryInterface.bulkInsert('BookSeries', [
Expand Down
Loading