@burojs/test-helpers 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/index.cjs +322 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +201 -0
- package/dist/index.d.ts +201 -0
- package/dist/index.js +311 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ErasedQueryDescriptor, ErasedMutationDescriptor, BatchedQueryOperation, DataProvider } from '@burojs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Subset of Playwright's Page API that we depend on.
|
|
5
|
+
* Real consumers pass a real Page; tests pass a mock.
|
|
6
|
+
*/
|
|
7
|
+
interface PlaywrightLocator {
|
|
8
|
+
click: () => Promise<void>;
|
|
9
|
+
fill: (value: string) => Promise<void>;
|
|
10
|
+
textContent: () => Promise<string | null>;
|
|
11
|
+
getByTestId: (id: string) => PlaywrightLocator;
|
|
12
|
+
getByRole: (role: string, opts?: {
|
|
13
|
+
name?: string | RegExp;
|
|
14
|
+
}) => PlaywrightLocator;
|
|
15
|
+
isVisible: () => Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
interface PlaywrightPage {
|
|
18
|
+
goto: (url: string) => Promise<unknown>;
|
|
19
|
+
getByTestId: (id: string) => PlaywrightLocator;
|
|
20
|
+
getByRole: (role: string, opts?: {
|
|
21
|
+
name?: string | RegExp;
|
|
22
|
+
}) => PlaywrightLocator;
|
|
23
|
+
url: () => string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface FormFieldObject {
|
|
27
|
+
input: () => PlaywrightLocator;
|
|
28
|
+
error: () => PlaywrightLocator;
|
|
29
|
+
help: () => PlaywrightLocator;
|
|
30
|
+
}
|
|
31
|
+
interface FormView {
|
|
32
|
+
field: (fieldName: string) => FormFieldObject;
|
|
33
|
+
section: (sectionKey: string) => PlaywrightLocator;
|
|
34
|
+
submit: () => PlaywrightLocator;
|
|
35
|
+
cancel: () => PlaywrightLocator;
|
|
36
|
+
action: (actionName: string) => PlaywrightLocator;
|
|
37
|
+
}
|
|
38
|
+
declare function createFormView(page: PlaywrightPage, resource: string, view: 'create' | 'edit' | 'show'): FormView;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A row's address inside the filter-builder draft: `[]` is the root group,
|
|
42
|
+
* `[0]` is its first row, `[1, 0]` is the first row of the group nested at
|
|
43
|
+
* top-level index 1. Mirrors `DraftPath` in
|
|
44
|
+
* `packages/ui-shadcn/src/list-kit/filter-builder/draft.ts` — the testid
|
|
45
|
+
* suffix is `path.join('-')` (an empty path renders as the empty string, so
|
|
46
|
+
* the root group's own testid carries a trailing `:`, e.g.
|
|
47
|
+
* `list-filter:<r>:group::add-row`).
|
|
48
|
+
*/
|
|
49
|
+
type FilterRowPath = readonly number[];
|
|
50
|
+
interface ListView {
|
|
51
|
+
goto: () => Promise<void>;
|
|
52
|
+
row: (recordId: string) => RowObject;
|
|
53
|
+
search: () => PlaywrightLocator;
|
|
54
|
+
/** The filter region container — `list-filters:<resource>`. */
|
|
55
|
+
filtersContainer: () => PlaywrightLocator;
|
|
56
|
+
/** Opens/closes the filter-builder popover. */
|
|
57
|
+
filterButton: () => PlaywrightLocator;
|
|
58
|
+
/** The popover body once open. */
|
|
59
|
+
filterPanel: () => PlaywrightLocator;
|
|
60
|
+
/** "+ Filter" — appends a new predicate row to the group at `groupPath` (root: `[]`). */
|
|
61
|
+
filterAddRow: (groupPath?: FilterRowPath) => PlaywrightLocator;
|
|
62
|
+
/** Field-select trigger for the row at `path`. */
|
|
63
|
+
filterRowField: (path: FilterRowPath) => PlaywrightLocator;
|
|
64
|
+
/** One field option inside an open field-select. */
|
|
65
|
+
filterRowFieldOption: (path: FilterRowPath, field: string) => PlaywrightLocator;
|
|
66
|
+
/** Operator-select trigger for the row at `path`. */
|
|
67
|
+
filterRowOp: (path: FilterRowPath) => PlaywrightLocator;
|
|
68
|
+
/** One operator option inside an open operator-select. */
|
|
69
|
+
filterRowOpOption: (path: FilterRowPath, op: string) => PlaywrightLocator;
|
|
70
|
+
/** Value control trigger/input for the row at `path` — shape depends on the field kind (text box, enum/relation/boolean popover). */
|
|
71
|
+
filterRowValue: (path: FilterRowPath) => PlaywrightLocator;
|
|
72
|
+
/** Removes the row at `path` from the draft (inside the panel, before Apply). */
|
|
73
|
+
filterRowRemove: (path: FilterRowPath) => PlaywrightLocator;
|
|
74
|
+
/** Commits the draft — applies it and closes the panel. */
|
|
75
|
+
filterApply: () => PlaywrightLocator;
|
|
76
|
+
/** Clears the draft back to empty (still requires Apply to take effect). */
|
|
77
|
+
filterReset: () => PlaywrightLocator;
|
|
78
|
+
/** One applied-filter badge outside the panel, by its top-level index. */
|
|
79
|
+
filterBadge: (index: number) => PlaywrightLocator;
|
|
80
|
+
/** A badge's × — removes that row immediately, no Apply needed. */
|
|
81
|
+
filterBadgeRemove: (index: number) => PlaywrightLocator;
|
|
82
|
+
/** "Clear all" — empties both the pinned slot and the builder group. */
|
|
83
|
+
filterClearAll: () => PlaywrightLocator;
|
|
84
|
+
/** An always-visible pinned control (`views.list.filters.pinned`) for `field`, rendered outside the panel. */
|
|
85
|
+
filterPinned: (field: string) => PlaywrightLocator;
|
|
86
|
+
paginationPrev: () => PlaywrightLocator;
|
|
87
|
+
paginationNext: () => PlaywrightLocator;
|
|
88
|
+
empty: () => PlaywrightLocator;
|
|
89
|
+
toolbar: () => PlaywrightLocator;
|
|
90
|
+
table: () => PlaywrightLocator;
|
|
91
|
+
}
|
|
92
|
+
interface RowObject {
|
|
93
|
+
cell: (fieldName: string) => PlaywrightLocator;
|
|
94
|
+
action: (actionName: string) => PlaywrightLocator;
|
|
95
|
+
checkbox: () => PlaywrightLocator;
|
|
96
|
+
open: () => Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
interface ListViewOptions {
|
|
99
|
+
basePath?: string;
|
|
100
|
+
}
|
|
101
|
+
declare function createListView(page: PlaywrightPage, resource: string, options?: ListViewOptions): ListView;
|
|
102
|
+
|
|
103
|
+
interface PickerObject {
|
|
104
|
+
dialog: () => PlaywrightLocator;
|
|
105
|
+
popover: () => PlaywrightLocator;
|
|
106
|
+
option: (value: string) => PlaywrightLocator;
|
|
107
|
+
search: () => PlaywrightLocator;
|
|
108
|
+
clear: () => PlaywrightLocator;
|
|
109
|
+
quickCreate: () => PlaywrightLocator;
|
|
110
|
+
}
|
|
111
|
+
declare function createPickerObject(page: PlaywrightPage, targetResource: string): PickerObject;
|
|
112
|
+
|
|
113
|
+
type ShowView = FormView;
|
|
114
|
+
declare function createShowView(page: PlaywrightPage, resource: string): ShowView;
|
|
115
|
+
|
|
116
|
+
interface ResourceObject {
|
|
117
|
+
name: string;
|
|
118
|
+
list: (options?: ListViewOptions) => ListView;
|
|
119
|
+
edit: (recordId: string) => FormView;
|
|
120
|
+
show: (recordId: string) => ShowView;
|
|
121
|
+
create: () => FormView;
|
|
122
|
+
picker: () => PickerObject;
|
|
123
|
+
}
|
|
124
|
+
declare function createResourceObject(page: PlaywrightPage, name: string): ResourceObject;
|
|
125
|
+
|
|
126
|
+
interface BuroPage {
|
|
127
|
+
resource: (name: string) => ResourceObject;
|
|
128
|
+
contextPicker: (sliceName: string) => PlaywrightLocator;
|
|
129
|
+
notification: (type: 'success' | 'error' | 'progress' | 'info') => PlaywrightLocator;
|
|
130
|
+
actionConfirm: (resource: string, scope: string, actionName: string) => PlaywrightLocator;
|
|
131
|
+
page: PlaywrightPage;
|
|
132
|
+
}
|
|
133
|
+
declare function createBuroPage(page: PlaywrightPage): BuroPage;
|
|
134
|
+
|
|
135
|
+
interface ConfirmDialogObject {
|
|
136
|
+
dialog: () => PlaywrightLocator;
|
|
137
|
+
yes: () => PlaywrightLocator;
|
|
138
|
+
no: () => PlaywrightLocator;
|
|
139
|
+
}
|
|
140
|
+
declare function createConfirmDialog(page: PlaywrightPage, resource: string, scope: string, actionName: string): ConfirmDialogObject;
|
|
141
|
+
|
|
142
|
+
type QueryKind = ErasedQueryDescriptor['kind'];
|
|
143
|
+
type MutationKind = ErasedMutationDescriptor['kind'];
|
|
144
|
+
interface ProviderObservedCall {
|
|
145
|
+
readonly lifecycle: 'query' | 'mutation' | 'batch' | 'live-open' | 'live-subscribe';
|
|
146
|
+
readonly kind?: QueryKind | MutationKind;
|
|
147
|
+
readonly descriptor?: ErasedQueryDescriptor | ErasedMutationDescriptor;
|
|
148
|
+
readonly descriptors?: readonly ErasedQueryDescriptor[];
|
|
149
|
+
readonly signal?: AbortSignal;
|
|
150
|
+
}
|
|
151
|
+
/** Specimens supplied by an adapter author; unsupported optional methods are omitted. */
|
|
152
|
+
interface ProviderContractDescriptors {
|
|
153
|
+
readonly queries?: Partial<Record<QueryKind, ErasedQueryDescriptor>>;
|
|
154
|
+
readonly mutations?: Partial<Record<MutationKind, ErasedMutationDescriptor>>;
|
|
155
|
+
readonly batch?: readonly BatchedQueryOperation[];
|
|
156
|
+
/** Independent batch groups prove that grouping is explicit, never merged by the helper. */
|
|
157
|
+
readonly batchGroups?: readonly (readonly BatchedQueryOperation[])[];
|
|
158
|
+
/** List specimens for both pagination protocols, including expected totals/pageInfo. */
|
|
159
|
+
readonly pagination?: {
|
|
160
|
+
readonly offset?: ErasedQueryDescriptor;
|
|
161
|
+
readonly cursor?: ErasedQueryDescriptor;
|
|
162
|
+
};
|
|
163
|
+
readonly live?: ErasedQueryDescriptor;
|
|
164
|
+
/** Error specimens must make the selected handler reject with a DataError. */
|
|
165
|
+
readonly errors?: readonly ProviderContractErrorSpecimen[];
|
|
166
|
+
/** Hand-authored mapped results; assertions never derive expectations from an adapter. */
|
|
167
|
+
readonly expected?: {
|
|
168
|
+
readonly queries?: Partial<Record<QueryKind, unknown>>;
|
|
169
|
+
readonly mutations?: Partial<Record<MutationKind, unknown>>;
|
|
170
|
+
readonly batch?: unknown;
|
|
171
|
+
readonly pagination?: {
|
|
172
|
+
readonly offset?: unknown;
|
|
173
|
+
readonly cursor?: unknown;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
type ProviderContractErrorSpecimen = {
|
|
178
|
+
readonly lifecycle: 'query';
|
|
179
|
+
readonly kind: QueryKind;
|
|
180
|
+
readonly descriptor: ErasedQueryDescriptor;
|
|
181
|
+
} | {
|
|
182
|
+
readonly lifecycle: 'mutation';
|
|
183
|
+
readonly kind: MutationKind;
|
|
184
|
+
readonly descriptor: ErasedMutationDescriptor;
|
|
185
|
+
};
|
|
186
|
+
interface ProviderContractFixture {
|
|
187
|
+
create(): DataProvider | Promise<DataProvider>;
|
|
188
|
+
descriptors: ProviderContractDescriptors;
|
|
189
|
+
observeCalls(): readonly ProviderObservedCall[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Registers transport-agnostic provider conformance tests. It intentionally
|
|
193
|
+
* imports only core contracts: adapters supply their own deterministic client
|
|
194
|
+
* and expose provider-boundary observations through the fixture.
|
|
195
|
+
*/
|
|
196
|
+
declare function dataProviderContract(name: string, fixture: ProviderContractFixture): void;
|
|
197
|
+
|
|
198
|
+
declare const PACKAGE_NAME: "@burojs/test-helpers";
|
|
199
|
+
declare const PACKAGE_VERSION: "0.0.0";
|
|
200
|
+
|
|
201
|
+
export { type BuroPage, type ConfirmDialogObject, type FormFieldObject, type FormView, type ListView, type ListViewOptions, PACKAGE_NAME, PACKAGE_VERSION, type PickerObject, type PlaywrightLocator, type PlaywrightPage, type ProviderContractDescriptors, type ProviderContractFixture, type ProviderObservedCall, type ResourceObject, type RowObject, type ShowView, createBuroPage, createConfirmDialog, createFormView, createListView, createPickerObject, createResourceObject, createShowView, dataProviderContract };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ErasedQueryDescriptor, ErasedMutationDescriptor, BatchedQueryOperation, DataProvider } from '@burojs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Subset of Playwright's Page API that we depend on.
|
|
5
|
+
* Real consumers pass a real Page; tests pass a mock.
|
|
6
|
+
*/
|
|
7
|
+
interface PlaywrightLocator {
|
|
8
|
+
click: () => Promise<void>;
|
|
9
|
+
fill: (value: string) => Promise<void>;
|
|
10
|
+
textContent: () => Promise<string | null>;
|
|
11
|
+
getByTestId: (id: string) => PlaywrightLocator;
|
|
12
|
+
getByRole: (role: string, opts?: {
|
|
13
|
+
name?: string | RegExp;
|
|
14
|
+
}) => PlaywrightLocator;
|
|
15
|
+
isVisible: () => Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
interface PlaywrightPage {
|
|
18
|
+
goto: (url: string) => Promise<unknown>;
|
|
19
|
+
getByTestId: (id: string) => PlaywrightLocator;
|
|
20
|
+
getByRole: (role: string, opts?: {
|
|
21
|
+
name?: string | RegExp;
|
|
22
|
+
}) => PlaywrightLocator;
|
|
23
|
+
url: () => string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface FormFieldObject {
|
|
27
|
+
input: () => PlaywrightLocator;
|
|
28
|
+
error: () => PlaywrightLocator;
|
|
29
|
+
help: () => PlaywrightLocator;
|
|
30
|
+
}
|
|
31
|
+
interface FormView {
|
|
32
|
+
field: (fieldName: string) => FormFieldObject;
|
|
33
|
+
section: (sectionKey: string) => PlaywrightLocator;
|
|
34
|
+
submit: () => PlaywrightLocator;
|
|
35
|
+
cancel: () => PlaywrightLocator;
|
|
36
|
+
action: (actionName: string) => PlaywrightLocator;
|
|
37
|
+
}
|
|
38
|
+
declare function createFormView(page: PlaywrightPage, resource: string, view: 'create' | 'edit' | 'show'): FormView;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A row's address inside the filter-builder draft: `[]` is the root group,
|
|
42
|
+
* `[0]` is its first row, `[1, 0]` is the first row of the group nested at
|
|
43
|
+
* top-level index 1. Mirrors `DraftPath` in
|
|
44
|
+
* `packages/ui-shadcn/src/list-kit/filter-builder/draft.ts` — the testid
|
|
45
|
+
* suffix is `path.join('-')` (an empty path renders as the empty string, so
|
|
46
|
+
* the root group's own testid carries a trailing `:`, e.g.
|
|
47
|
+
* `list-filter:<r>:group::add-row`).
|
|
48
|
+
*/
|
|
49
|
+
type FilterRowPath = readonly number[];
|
|
50
|
+
interface ListView {
|
|
51
|
+
goto: () => Promise<void>;
|
|
52
|
+
row: (recordId: string) => RowObject;
|
|
53
|
+
search: () => PlaywrightLocator;
|
|
54
|
+
/** The filter region container — `list-filters:<resource>`. */
|
|
55
|
+
filtersContainer: () => PlaywrightLocator;
|
|
56
|
+
/** Opens/closes the filter-builder popover. */
|
|
57
|
+
filterButton: () => PlaywrightLocator;
|
|
58
|
+
/** The popover body once open. */
|
|
59
|
+
filterPanel: () => PlaywrightLocator;
|
|
60
|
+
/** "+ Filter" — appends a new predicate row to the group at `groupPath` (root: `[]`). */
|
|
61
|
+
filterAddRow: (groupPath?: FilterRowPath) => PlaywrightLocator;
|
|
62
|
+
/** Field-select trigger for the row at `path`. */
|
|
63
|
+
filterRowField: (path: FilterRowPath) => PlaywrightLocator;
|
|
64
|
+
/** One field option inside an open field-select. */
|
|
65
|
+
filterRowFieldOption: (path: FilterRowPath, field: string) => PlaywrightLocator;
|
|
66
|
+
/** Operator-select trigger for the row at `path`. */
|
|
67
|
+
filterRowOp: (path: FilterRowPath) => PlaywrightLocator;
|
|
68
|
+
/** One operator option inside an open operator-select. */
|
|
69
|
+
filterRowOpOption: (path: FilterRowPath, op: string) => PlaywrightLocator;
|
|
70
|
+
/** Value control trigger/input for the row at `path` — shape depends on the field kind (text box, enum/relation/boolean popover). */
|
|
71
|
+
filterRowValue: (path: FilterRowPath) => PlaywrightLocator;
|
|
72
|
+
/** Removes the row at `path` from the draft (inside the panel, before Apply). */
|
|
73
|
+
filterRowRemove: (path: FilterRowPath) => PlaywrightLocator;
|
|
74
|
+
/** Commits the draft — applies it and closes the panel. */
|
|
75
|
+
filterApply: () => PlaywrightLocator;
|
|
76
|
+
/** Clears the draft back to empty (still requires Apply to take effect). */
|
|
77
|
+
filterReset: () => PlaywrightLocator;
|
|
78
|
+
/** One applied-filter badge outside the panel, by its top-level index. */
|
|
79
|
+
filterBadge: (index: number) => PlaywrightLocator;
|
|
80
|
+
/** A badge's × — removes that row immediately, no Apply needed. */
|
|
81
|
+
filterBadgeRemove: (index: number) => PlaywrightLocator;
|
|
82
|
+
/** "Clear all" — empties both the pinned slot and the builder group. */
|
|
83
|
+
filterClearAll: () => PlaywrightLocator;
|
|
84
|
+
/** An always-visible pinned control (`views.list.filters.pinned`) for `field`, rendered outside the panel. */
|
|
85
|
+
filterPinned: (field: string) => PlaywrightLocator;
|
|
86
|
+
paginationPrev: () => PlaywrightLocator;
|
|
87
|
+
paginationNext: () => PlaywrightLocator;
|
|
88
|
+
empty: () => PlaywrightLocator;
|
|
89
|
+
toolbar: () => PlaywrightLocator;
|
|
90
|
+
table: () => PlaywrightLocator;
|
|
91
|
+
}
|
|
92
|
+
interface RowObject {
|
|
93
|
+
cell: (fieldName: string) => PlaywrightLocator;
|
|
94
|
+
action: (actionName: string) => PlaywrightLocator;
|
|
95
|
+
checkbox: () => PlaywrightLocator;
|
|
96
|
+
open: () => Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
interface ListViewOptions {
|
|
99
|
+
basePath?: string;
|
|
100
|
+
}
|
|
101
|
+
declare function createListView(page: PlaywrightPage, resource: string, options?: ListViewOptions): ListView;
|
|
102
|
+
|
|
103
|
+
interface PickerObject {
|
|
104
|
+
dialog: () => PlaywrightLocator;
|
|
105
|
+
popover: () => PlaywrightLocator;
|
|
106
|
+
option: (value: string) => PlaywrightLocator;
|
|
107
|
+
search: () => PlaywrightLocator;
|
|
108
|
+
clear: () => PlaywrightLocator;
|
|
109
|
+
quickCreate: () => PlaywrightLocator;
|
|
110
|
+
}
|
|
111
|
+
declare function createPickerObject(page: PlaywrightPage, targetResource: string): PickerObject;
|
|
112
|
+
|
|
113
|
+
type ShowView = FormView;
|
|
114
|
+
declare function createShowView(page: PlaywrightPage, resource: string): ShowView;
|
|
115
|
+
|
|
116
|
+
interface ResourceObject {
|
|
117
|
+
name: string;
|
|
118
|
+
list: (options?: ListViewOptions) => ListView;
|
|
119
|
+
edit: (recordId: string) => FormView;
|
|
120
|
+
show: (recordId: string) => ShowView;
|
|
121
|
+
create: () => FormView;
|
|
122
|
+
picker: () => PickerObject;
|
|
123
|
+
}
|
|
124
|
+
declare function createResourceObject(page: PlaywrightPage, name: string): ResourceObject;
|
|
125
|
+
|
|
126
|
+
interface BuroPage {
|
|
127
|
+
resource: (name: string) => ResourceObject;
|
|
128
|
+
contextPicker: (sliceName: string) => PlaywrightLocator;
|
|
129
|
+
notification: (type: 'success' | 'error' | 'progress' | 'info') => PlaywrightLocator;
|
|
130
|
+
actionConfirm: (resource: string, scope: string, actionName: string) => PlaywrightLocator;
|
|
131
|
+
page: PlaywrightPage;
|
|
132
|
+
}
|
|
133
|
+
declare function createBuroPage(page: PlaywrightPage): BuroPage;
|
|
134
|
+
|
|
135
|
+
interface ConfirmDialogObject {
|
|
136
|
+
dialog: () => PlaywrightLocator;
|
|
137
|
+
yes: () => PlaywrightLocator;
|
|
138
|
+
no: () => PlaywrightLocator;
|
|
139
|
+
}
|
|
140
|
+
declare function createConfirmDialog(page: PlaywrightPage, resource: string, scope: string, actionName: string): ConfirmDialogObject;
|
|
141
|
+
|
|
142
|
+
type QueryKind = ErasedQueryDescriptor['kind'];
|
|
143
|
+
type MutationKind = ErasedMutationDescriptor['kind'];
|
|
144
|
+
interface ProviderObservedCall {
|
|
145
|
+
readonly lifecycle: 'query' | 'mutation' | 'batch' | 'live-open' | 'live-subscribe';
|
|
146
|
+
readonly kind?: QueryKind | MutationKind;
|
|
147
|
+
readonly descriptor?: ErasedQueryDescriptor | ErasedMutationDescriptor;
|
|
148
|
+
readonly descriptors?: readonly ErasedQueryDescriptor[];
|
|
149
|
+
readonly signal?: AbortSignal;
|
|
150
|
+
}
|
|
151
|
+
/** Specimens supplied by an adapter author; unsupported optional methods are omitted. */
|
|
152
|
+
interface ProviderContractDescriptors {
|
|
153
|
+
readonly queries?: Partial<Record<QueryKind, ErasedQueryDescriptor>>;
|
|
154
|
+
readonly mutations?: Partial<Record<MutationKind, ErasedMutationDescriptor>>;
|
|
155
|
+
readonly batch?: readonly BatchedQueryOperation[];
|
|
156
|
+
/** Independent batch groups prove that grouping is explicit, never merged by the helper. */
|
|
157
|
+
readonly batchGroups?: readonly (readonly BatchedQueryOperation[])[];
|
|
158
|
+
/** List specimens for both pagination protocols, including expected totals/pageInfo. */
|
|
159
|
+
readonly pagination?: {
|
|
160
|
+
readonly offset?: ErasedQueryDescriptor;
|
|
161
|
+
readonly cursor?: ErasedQueryDescriptor;
|
|
162
|
+
};
|
|
163
|
+
readonly live?: ErasedQueryDescriptor;
|
|
164
|
+
/** Error specimens must make the selected handler reject with a DataError. */
|
|
165
|
+
readonly errors?: readonly ProviderContractErrorSpecimen[];
|
|
166
|
+
/** Hand-authored mapped results; assertions never derive expectations from an adapter. */
|
|
167
|
+
readonly expected?: {
|
|
168
|
+
readonly queries?: Partial<Record<QueryKind, unknown>>;
|
|
169
|
+
readonly mutations?: Partial<Record<MutationKind, unknown>>;
|
|
170
|
+
readonly batch?: unknown;
|
|
171
|
+
readonly pagination?: {
|
|
172
|
+
readonly offset?: unknown;
|
|
173
|
+
readonly cursor?: unknown;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
type ProviderContractErrorSpecimen = {
|
|
178
|
+
readonly lifecycle: 'query';
|
|
179
|
+
readonly kind: QueryKind;
|
|
180
|
+
readonly descriptor: ErasedQueryDescriptor;
|
|
181
|
+
} | {
|
|
182
|
+
readonly lifecycle: 'mutation';
|
|
183
|
+
readonly kind: MutationKind;
|
|
184
|
+
readonly descriptor: ErasedMutationDescriptor;
|
|
185
|
+
};
|
|
186
|
+
interface ProviderContractFixture {
|
|
187
|
+
create(): DataProvider | Promise<DataProvider>;
|
|
188
|
+
descriptors: ProviderContractDescriptors;
|
|
189
|
+
observeCalls(): readonly ProviderObservedCall[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Registers transport-agnostic provider conformance tests. It intentionally
|
|
193
|
+
* imports only core contracts: adapters supply their own deterministic client
|
|
194
|
+
* and expose provider-boundary observations through the fixture.
|
|
195
|
+
*/
|
|
196
|
+
declare function dataProviderContract(name: string, fixture: ProviderContractFixture): void;
|
|
197
|
+
|
|
198
|
+
declare const PACKAGE_NAME: "@burojs/test-helpers";
|
|
199
|
+
declare const PACKAGE_VERSION: "0.0.0";
|
|
200
|
+
|
|
201
|
+
export { type BuroPage, type ConfirmDialogObject, type FormFieldObject, type FormView, type ListView, type ListViewOptions, PACKAGE_NAME, PACKAGE_VERSION, type PickerObject, type PlaywrightLocator, type PlaywrightPage, type ProviderContractDescriptors, type ProviderContractFixture, type ProviderObservedCall, type ResourceObject, type RowObject, type ShowView, createBuroPage, createConfirmDialog, createFormView, createListView, createPickerObject, createResourceObject, createShowView, dataProviderContract };
|