( framework: string, harness: ComponentHarness, components: ProviderComponents, )
| 525 | }; |
| 526 | |
| 527 | export const testProviderComponents = ( |
| 528 | framework: string, |
| 529 | harness: ComponentHarness, |
| 530 | components: ProviderComponents, |
| 531 | ): void => { |
| 532 | let store: Store; |
| 533 | |
| 534 | beforeEach(() => { |
| 535 | store = createTestStore(); |
| 536 | }); |
| 537 | |
| 538 | describe(`${framework} provider component scenarios`, () => { |
| 539 | if (components.Store != null) { |
| 540 | describe('store', () => { |
| 541 | test.each([ |
| 542 | [ |
| 543 | 'tables', |
| 544 | // eslint-disable-next-line max-len |
| 545 | '1234{"t1":{"r1":{"c1":1}},"t2":{"r1":{"c1":2},"r2":{"c1":3,"c2":4}}}', |
| 546 | () => store.setTables({t1: {r1: {c1: 2}}}), |
| 547 | '2{"t1":{"r1":{"c1":2}}}', |
| 548 | () => store.delTables(), |
| 549 | '{}', |
| 550 | ], |
| 551 | [ |
| 552 | 'table', |
| 553 | '1{"r1":{"c1":1}}', |
| 554 | () => store.setTable('t1', {r1: {c1: 2}}), |
| 555 | '2{"r1":{"c1":2}}', |
| 556 | () => store.delTable('t1'), |
| 557 | '{}', |
| 558 | ], |
| 559 | [ |
| 560 | 'row', |
| 561 | '1{"c1":1}', |
| 562 | () => store.setRow('t1', 'r1', {c1: 2}), |
| 563 | '2{"c1":2}', |
| 564 | () => store.delRow('t1', 'r1'), |
| 565 | '{}', |
| 566 | ], |
| 567 | [ |
| 568 | 'cell', |
| 569 | '11', |
| 570 | () => store.setCell('t1', 'r1', 'c1', 2), |
| 571 | '22', |
| 572 | () => store.delCell('t1', 'r1', 'c1'), |
| 573 | '', |
| 574 | ], |
| 575 | ])( |
| 576 | 'default %s', |
| 577 | async (mode, initial, update, updated, remove, removed) => { |
| 578 | const {container, unmount} = harness.render(components.Store, { |
| 579 | store, |
| 580 | mode, |
| 581 | }); |
| 582 | expect(container.textContent).toEqual(initial); |
| 583 | await harness.act(update); |
| 584 | expect(container.textContent).toEqual(updated); |
no test coverage detected
searching dependent graphs…