mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-03-10 00:17:21 +01:00
Fix all date constructors to Date(0) to prevent test flakiness
This commit is contained in:
parent
565eb423ee
commit
741ae2216a
@ -91,9 +91,9 @@ describe('migration-v2.15.0-series-column-unique', () => {
|
|||||||
it('upgrade with no duplicate series', async () => {
|
it('upgrade with no duplicate series', async () => {
|
||||||
// Add some entries to the Series table using the UUID for the ids
|
// Add some entries to the Series table using the UUID for the ids
|
||||||
await queryInterface.bulkInsert('Series', [
|
await queryInterface.bulkInsert('Series', [
|
||||||
{ id: series1Id, 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 2', libraryId: library2Id, createdAt: new Date(), updatedAt: new Date() },
|
{ 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(), updatedAt: new Date() }
|
{ id: series3Id, name: 'Series 3', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
|
||||||
])
|
])
|
||||||
// Add some entries to the BookSeries table
|
// Add some entries to the BookSeries table
|
||||||
await queryInterface.bulkInsert('BookSeries', [
|
await queryInterface.bulkInsert('BookSeries', [
|
||||||
@ -126,9 +126,9 @@ describe('migration-v2.15.0-series-column-unique', () => {
|
|||||||
it('upgrade with duplicate series and no sequence', async () => {
|
it('upgrade with duplicate series and no sequence', async () => {
|
||||||
// Add some entries to the Series table using the UUID for the ids
|
// Add some entries to the Series table using the UUID for the ids
|
||||||
await queryInterface.bulkInsert('Series', [
|
await queryInterface.bulkInsert('Series', [
|
||||||
{ id: series1Id, 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 2', libraryId: library2Id, createdAt: new Date(), updatedAt: new Date() },
|
{ 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(), updatedAt: new Date() },
|
{ 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: 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: 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) }
|
{ id: series1Id_dup2, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
|
||||||
@ -172,8 +172,8 @@ describe('migration-v2.15.0-series-column-unique', () => {
|
|||||||
it('upgrade with same series name in different libraries', async () => {
|
it('upgrade with same series name in different libraries', async () => {
|
||||||
// Add some entries to the Series table using the UUID for the ids
|
// Add some entries to the Series table using the UUID for the ids
|
||||||
await queryInterface.bulkInsert('Series', [
|
await queryInterface.bulkInsert('Series', [
|
||||||
{ id: series1Id, 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: library2Id, createdAt: new Date(), updatedAt: new Date() }
|
{ id: series2Id, name: 'Series 1', libraryId: library2Id, createdAt: new Date(0), updatedAt: new Date(0) }
|
||||||
])
|
])
|
||||||
// Add some entries to the BookSeries table
|
// Add some entries to the BookSeries table
|
||||||
await queryInterface.bulkInsert('BookSeries', [
|
await queryInterface.bulkInsert('BookSeries', [
|
||||||
@ -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 () => {
|
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
|
// Create two different series with the same name in the same library
|
||||||
await queryInterface.bulkInsert('Series', [
|
await queryInterface.bulkInsert('Series', [
|
||||||
{ id: series1Id, 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(), updatedAt: new Date() }
|
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
|
||||||
])
|
])
|
||||||
// Create a book that is in both series
|
// Create a book that is in both series
|
||||||
await queryInterface.bulkInsert('BookSeries', [
|
await queryInterface.bulkInsert('BookSeries', [
|
||||||
@ -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 () => {
|
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
|
// Create two different series with the same name in the same library
|
||||||
await queryInterface.bulkInsert('Series', [
|
await queryInterface.bulkInsert('Series', [
|
||||||
{ id: series1Id, 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(), updatedAt: new Date() }
|
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
|
||||||
])
|
])
|
||||||
// Create a book that is in both series
|
// Create a book that is in both series
|
||||||
await queryInterface.bulkInsert('BookSeries', [
|
await queryInterface.bulkInsert('BookSeries', [
|
||||||
@ -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 () => {
|
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
|
// Create two different series with the same name in the same library
|
||||||
await queryInterface.bulkInsert('Series', [
|
await queryInterface.bulkInsert('Series', [
|
||||||
{ id: series1Id, 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(), updatedAt: new Date() }
|
{ id: series2Id, name: 'Series 1', libraryId: library1Id, createdAt: new Date(0), updatedAt: new Date(0) }
|
||||||
])
|
])
|
||||||
// Create a book that is in both series
|
// Create a book that is in both series
|
||||||
await queryInterface.bulkInsert('BookSeries', [
|
await queryInterface.bulkInsert('BookSeries', [
|
||||||
|
Loading…
Reference in New Issue
Block a user