File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import registerExecuteBatchUnitTests from './specs/operations/executeBatch.spec'
66import registerTypeORMUnitTestsSpecs from './specs/typeorm.spec'
77import registerDatabaseQueueUnitTests from './specs/DatabaseQueue.spec'
88import registerSqliteVecUnitTestsSpecs from './specs/sqlite-vec.spec'
9+ import registerExternalMemoryUnitTests from './specs/externalMemory.spec'
910
1011export function registerUnitTests ( ) {
1112 beforeEach ( setupTestDb )
@@ -16,6 +17,8 @@ export function registerUnitTests() {
1617 registerExecuteBatchUnitTests ( )
1718 } )
1819
20+ registerExternalMemoryUnitTests ( )
21+
1922 registerDatabaseQueueUnitTests ( )
2023}
2124
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from '@tests/TestApi'
2+ import { testDb } from '@tests/db'
3+
4+ const LARGE_RESULT_ROW_COUNT = 25_000
5+
6+ export default function registerExternalMemoryUnitTests ( ) {
7+ describe ( 'External memory' , ( ) => {
8+ it ( 'does not reject a large query result as too much external memory' , ( ) => {
9+ const result = testDb . execute ( `
10+ WITH RECURSIVE numbers(value) AS (
11+ SELECT 1
12+ UNION ALL
13+ SELECT value + 1 FROM numbers WHERE value < ${ LARGE_RESULT_ROW_COUNT }
14+ )
15+ SELECT value FROM numbers
16+ ` )
17+
18+ expect ( result . rows ) . not . toBe ( undefined )
19+ expect ( result . rows ?. length ) . toBe ( LARGE_RESULT_ROW_COUNT )
20+ expect ( result . rows ?. item ( 0 ) ) . toEqual ( { value : 1 } )
21+ expect ( result . rows ?. item ( LARGE_RESULT_ROW_COUNT - 1 ) ) . toEqual ( {
22+ value : LARGE_RESULT_ROW_COUNT ,
23+ } )
24+ } )
25+ } )
26+ }
You can’t perform that action at this time.
0 commit comments