-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added flattenIterationResultItemArray
- Updated how maxPageLoadLimit is used, and how iteratorNextPageUntilPage functions. It now loads up to that page, which is the total number of pages loaded. Iterations now are 0-indexed.
- Loading branch information
Derek Burgman
committed
Jan 25, 2022
1 parent
ac4fd34
commit f3220c7
Showing
10 changed files
with
210 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { ItemPageIterator, ItemPageIteratorIterationInstance } from './iterator.page'; | ||
import { TestPageIteratorFilter, TEST_PAGE_ARRAY_ITERATOR_DELEGATE, TEST_PAGE_ARRAY_ITERATOR_PAGE_SIZE } from './iterator.page.spec'; | ||
import { iteratorNextPageUntilPage } from './iteration.next'; | ||
import { flattenIterationResultItemArray } from './iteration.rxjs'; | ||
import { first } from 'rxjs/operators'; | ||
|
||
describe('iteration.rxjs', () => { | ||
|
||
let iterator: ItemPageIterator<number[], TestPageIteratorFilter>; | ||
let instance: ItemPageIteratorIterationInstance<number[], TestPageIteratorFilter>; | ||
|
||
beforeEach(() => { | ||
iterator = new ItemPageIterator(TEST_PAGE_ARRAY_ITERATOR_DELEGATE); | ||
instance = iterator.instance({}); | ||
}); | ||
|
||
afterEach(() => { | ||
instance.destroy(); | ||
}); | ||
|
||
describe('flattenIterationResultItemArray()', () => { | ||
|
||
it(`should aggregate the array of results into a single array.`, (done) => { | ||
|
||
const testPagesToLoad = 10; | ||
|
||
iteratorNextPageUntilPage(instance, testPagesToLoad).then((page) => { | ||
expect(page).toBe(testPagesToLoad - 1); | ||
|
||
const obs = flattenIterationResultItemArray(instance); | ||
|
||
obs.pipe(first()).subscribe((values) => { | ||
expect(values.length).toBe(testPagesToLoad * TEST_PAGE_ARRAY_ITERATOR_PAGE_SIZE); | ||
done(); | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.