From cf2cdd3b9747fc3c1d4f50a14de05323b0f7743a Mon Sep 17 00:00:00 2001 From: Joe Bingham Date: Wed, 14 Oct 2020 16:33:25 -0700 Subject: [PATCH] Add basic props meta tests --- .../new_boilerplate/props_meta_test.dart | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart index d63345fac..a2d783b61 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart @@ -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)); @@ -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()); + }); + + test('via explicitly using the UiPropsMeta extension method', () { + expect(UiPropsMeta(Test()).meta, isNotNull); + expect(UiPropsMeta(Test()).meta, isA()); + }); + }); + }); + + commonMetaTests(UiPropsMeta(Test()).meta); }); }); }