Skip to content

Commit

Permalink
Rename toArray to flattenToArray
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Feb 20, 2025
1 parent a4ac684 commit c00b073
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/seam/connect/seam-paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class SeamPaginator<
] as const
}

async toArray(): Promise<EnsureReadonlyArray<TResponse[TResponseKey]>> {
async flattenToArray(): Promise<EnsureReadonlyArray<TResponse[TResponseKey]>> {
const items = [] as EnsureMutableArray<TResponse[TResponseKey]>
let [current, pagination] = await this.firstPage()
items.push(...current)
Expand Down
4 changes: 2 additions & 2 deletions test/seam/connect/seam-paginator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ test('SeamPaginator: nextPage requires the nextPageCursor', async (t) => {
})
})

test('SeamPaginator: toArray returns an array of devices', async (t) => {
test('SeamPaginator: flattenToArray returns an array of devices', async (t) => {
const { seed, endpoint } = await getTestServer(t)
const seam = SeamHttp.fromApiKey(seed.seam_apikey1_token, { endpoint })
const allDevices = await seam.devices.list()
const pages = seam.createPaginator(seam.devices.list({ limit: 1 }))
const devices = await pages.toArray()
const devices = await pages.flattenToArray()
t.true(devices.length > 1)
t.is(devices.length, allDevices.length)
})
Expand Down

0 comments on commit c00b073

Please sign in to comment.