Skip to content

Commit

Permalink
Add basic props meta tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joebingham-wk committed Oct 14, 2020
1 parent 25d6639 commit cf2cdd3
Showing 1 changed file with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ main() {
});
});

group('(field)', () {
final propsMeta = _$TestComponent().propsMeta;

void commonMetaTests(PropsMetaCollection propsMeta) {
test('provides access to the expected props', () {
expect(propsMeta.props.length, 3);
expect(propsMeta.props.map((prop) => prop.key), containsAll(expectedKeys));
Expand Down Expand Up @@ -147,6 +145,28 @@ main() {
}, tags: 'no-ddc');
});
});
}

group('(field)', () {
commonMetaTests(_$TestComponent().propsMeta);
});

group('(props instance)', () {
group('generates props meta utilities attached to the props instance', () {
group('that can be accessed', () {
test(r'directly via $meta', () {
expect(Test().$meta, isNotNull);
expect(Test().$meta, isA<PropsMetaCollection>());
});

test('via explicitly using the UiPropsMeta extension method', () {
expect(UiPropsMeta(Test()).meta, isNotNull);
expect(UiPropsMeta(Test()).meta, isA<PropsMetaCollection>());
});
});
});

commonMetaTests(UiPropsMeta(Test()).meta);
});
});
}
Expand Down

0 comments on commit cf2cdd3

Please sign in to comment.