File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as assert from "assert" ;
2+ import { testContext , disposeTestDocumentStore } from "../Utils/TestUtil" ;
3+
4+ import {
5+ IDocumentStore ,
6+ } from "../../src" ;
7+
8+ describe ( "RDBC-244" , function ( ) {
9+
10+ let store : IDocumentStore ;
11+
12+ beforeEach ( async function ( ) {
13+ testContext . customizeStore = async ( store ) => {
14+ store . conventions . findCollectionNameForObjectLiteral = x => "test" ;
15+ } ;
16+ store = await testContext . getDocumentStore ( ) ;
17+ } ) ;
18+
19+ afterEach ( async ( ) => {
20+ await disposeTestDocumentStore ( store ) ;
21+ } ) ;
22+
23+ it ( "can load more than 1024 docs in a single load" , async ( ) => {
24+
25+ const items = [ ] ;
26+ {
27+ const bulk = store . bulkInsert ( ) ;
28+ for ( let i = 0 ; i < 1500 ; i ++ ) {
29+ const item = {
30+ name : "Margarette" + i
31+ } ;
32+ await bulk . store ( item ) ;
33+ items . push ( item ) ;
34+ }
35+
36+ await bulk . finish ( ) ;
37+ }
38+
39+ const moreThan1024Ids = items . map ( x => x . id ) ;
40+ assert . strictEqual ( moreThan1024Ids . length , 1500 ) ;
41+
42+ {
43+ const session = store . openSession ( ) ;
44+ const loaded = await session . load ( moreThan1024Ids ) ;
45+ assert . strictEqual ( Object . keys ( loaded ) . length , 1500 ) ;
46+ assert . ok ( Object . keys ( loaded )
47+ . reduce ( ( result , item ) => [ ...result , loaded [ item ] ] , [ ] )
48+ . every ( x => x ) ) ;
49+ }
50+ } ) ;
51+ } ) ;
You can’t perform that action at this time.
0 commit comments