|
| 1 | +import { FFDocBase, Filters } from './ff-doc-base'; |
| 2 | +import { FFDocJson } from './frankdoc.types'; |
| 3 | + |
| 4 | +const labels: FFDocJson['labels'] = { |
| 5 | + Components: ['Senders', 'Listeners'], |
| 6 | + EIP: ['Listener', 'Endpoint'], |
| 7 | +}; |
| 8 | + |
| 9 | +const emptyFilters: Filters = { |
| 10 | + Components: { Senders: [], Listeners: [] }, |
| 11 | + EIP: { Listener: [], Endpoint: [] }, |
| 12 | +}; |
| 13 | + |
| 14 | +const filledFilters: Filters = { |
| 15 | + Components: { Senders: ['FixedResultSender'], Listeners: ['RestListener'] }, |
| 16 | + EIP: { Listener: ['RestListener'], Endpoint: ['FixedResultSender'] }, |
| 17 | +}; |
| 18 | + |
| 19 | +const elementNames: FFDocJson['elementNames'] = { |
| 20 | + FixedResultSender: { |
| 21 | + labels: { |
| 22 | + Components: 'Senders', |
| 23 | + EIP: 'Endpoint', |
| 24 | + }, |
| 25 | + className: 'org.frankframework.senders.FixedResultSender', |
| 26 | + }, |
| 27 | + RestListener: { |
| 28 | + labels: { |
| 29 | + Components: 'Listeners', |
| 30 | + EIP: 'Listener', |
| 31 | + }, |
| 32 | + className: 'org.frankframework.http.RestListener', |
| 33 | + }, |
| 34 | +}; |
| 35 | + |
| 36 | +class TestFFDoc extends FFDocBase { |
| 37 | + runTests(): void { |
| 38 | + it('should get filters list from ff-doc json labels', () => { |
| 39 | + expect(this.getFiltersFromLabels(labels)).toEqual(emptyFilters); |
| 40 | + }); |
| 41 | + |
| 42 | + it('should assign elements to filters', () => { |
| 43 | + const filters = this.getFiltersFromLabels(labels); |
| 44 | + expect(this.assignFrankDocElementsToFilters(filters, elementNames)).toEqual(filledFilters); |
| 45 | + }); |
| 46 | + |
| 47 | + /* What do we want to test here? |
| 48 | + * Doesn't make sense to just check if the function creates an object with the elements, |
| 49 | + * but to also check if the elements contain the right properties. |
| 50 | + * Maybe also caching whenever that's implemented? |
| 51 | + */ |
| 52 | + it("should convert json 'elements' & 'elementNames' to XMLElements"); |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +describe('FFDocBase', () => new TestFFDoc().runTests()); |
0 commit comments