@@ -14,7 +14,7 @@ import {
1414 generateLargeOutput ,
1515} from "./helpers/snapshotTestHelpers.js" ;
1616import { generateFriendlyId } from "@trigger.dev/core/v3/isomorphic" ;
17- import type { PrismaReplicaClient } from "@trigger.dev/database" ;
17+
1818
1919vi . setConfig ( { testTimeout : 120_000 } ) ;
2020
@@ -691,7 +691,7 @@ describe("RunEngine getSnapshotsSince", () => {
691691 // An empty (schema-only) database stands in for a read replica that has not
692692 // caught up: every lookup on it misses, so the engine must fall back to the
693693 // primary instead of failing the poll.
694- readOnlyPrisma : schemaOnlyPrisma as PrismaReplicaClient ,
694+ readOnlyPrisma : schemaOnlyPrisma ,
695695 readReplicaSnapshotsSinceEnabled : true ,
696696 worker : {
697697 redis : redisOptions ,
@@ -766,8 +766,12 @@ describe("RunEngine getSnapshotsSince", () => {
766766
767767 // Served by the primary fallback, not a failed poll.
768768 expect ( result ) . not . toBeNull ( ) ;
769- expect ( result ! . length ) . toBe ( allSnapshots . length - 1 ) ;
770- expect ( result ! . map ( ( s ) => s . snapshot . id ) ) . toEqual ( allSnapshots . slice ( 1 ) . map ( ( s ) => s . id ) ) ;
769+ const expectedSnapshots = allSnapshots . filter (
770+ ( s ) => s . createdAt . getTime ( ) > firstSnapshot . createdAt . getTime ( )
771+ ) ;
772+ expect ( expectedSnapshots . length ) . toBeGreaterThan ( 0 ) ;
773+ expect ( result ! . length ) . toBe ( expectedSnapshots . length ) ;
774+ expect ( result ! . map ( ( s ) => s . snapshot . id ) ) . toEqual ( expectedSnapshots . map ( ( s ) => s . id ) ) ;
771775 } finally {
772776 await engine . quit ( ) ;
773777 }
@@ -781,7 +785,7 @@ describe("RunEngine getSnapshotsSince", () => {
781785
782786 const engine = new RunEngine ( {
783787 prisma,
784- readOnlyPrisma : schemaOnlyPrisma as PrismaReplicaClient ,
788+ readOnlyPrisma : schemaOnlyPrisma ,
785789 readReplicaSnapshotsSinceEnabled : true ,
786790 worker : {
787791 redis : redisOptions ,
0 commit comments