Spaces:
Running
Running
Download source/teaql-ts/tests/smart-list.test.ts from teaql/browser-sqlite-playground: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/spaces/teaql/browser-sqlite-playground/resolve/main/source/teaql-ts/tests/smart-list.test.ts
- Command line
-
hf download hf://spaces/teaql/browser-sqlite-playground/source/teaql-ts/tests/smart-list.test.ts
-
curl -L -o smart-list.test.ts https://huggingface.co/spaces/teaql/browser-sqlite-playground/resolve/main/source/teaql-ts/tests/smart-list.test.ts
605 Bytes
| import { SmartList } from '../src'; | |
| describe('SmartList', () => { | |
| it('keeps array ergonomics and TeaQL query metadata', () => { | |
| const rows = new SmartList([{ id: 1 }, { id: 2 }]).withTotalCount(7); | |
| const facet = new SmartList<Record<string, unknown>>([{ status: 'OPEN' }]); | |
| rows.withFacet('status', facet); | |
| expect(rows).toBeInstanceOf(Array); | |
| expect(rows.map(row => row.id)).toEqual([1, 2]); | |
| expect(rows.data).toBe(rows); | |
| expect(rows.totalCountOrLength()).toBe(7); | |
| expect(rows.facet('status')).toBe(facet); | |
| expect(SmartList.empty().isLoaded).toBe(false); | |
| }); | |
| }); | |