@@ -13,16 +13,15 @@ void main() {
1313 const testEngagementContentType = EngagementContentType .signUp;
1414 const testCallToActionText = 'Sign Up Now!' ;
1515 const testCallToActionUrl = 'http://example.com/signup' ;
16- const defaultAction = OpenExternalUrl (url: 'http://default.com' );
16+ final defaultAction = OpenExternalUrl (url: 'http://default.com' );
1717
1818 EngagementContent createSubject ({
19- String ? id,
19+ required FeedItemAction action, String ? id,
2020 String title = testTitle,
2121 String ? description = testDescription,
2222 EngagementContentType engagementContentType = testEngagementContentType,
2323 String ? callToActionText = testCallToActionText,
2424 String ? callToActionUrl = testCallToActionUrl,
25- FeedItemAction action = defaultAction,
2625 }) {
2726 return EngagementContent (
2827 id: id,
@@ -37,18 +36,18 @@ void main() {
3736
3837 group ('constructor' , () {
3938 test ('generates id when not provided' , () {
40- final content = createSubject ();
39+ final content = createSubject (action : defaultAction );
4140 expect (content.id, isA <String >());
4241 expect (Uuid .isValidUUID (fromString: content.id), isTrue);
4342 });
4443
4544 test ('uses provided id' , () {
46- final content = createSubject (id: testId);
45+ final content = createSubject (id: testId, action : defaultAction );
4746 expect (content.id, testId);
4847 });
4948
5049 test ('initializes all properties correctly' , () {
51- final content = createSubject ();
50+ final content = createSubject (action : defaultAction );
5251 expect (content.title, testTitle);
5352 expect (content.description, testDescription);
5453 expect (content.engagementContentType, testEngagementContentType);
@@ -66,12 +65,12 @@ void main() {
6665 const newEngagementContentType = EngagementContentType .feedback;
6766 const newCallToActionText = 'Give Feedback' ;
6867 const newCallToActionUrl = 'http://example.com/feedback' ;
69- const newAction = OpenInternalContent (
68+ final newAction = OpenInternalContent (
7069 contentId: 'feedback-id' ,
7170 contentType: ContentType .category,
7271 );
7372
74- final originalContent = createSubject ();
73+ final originalContent = createSubject (action : defaultAction );
7574 final updatedContent = originalContent.copyWith (
7675 title: newTitle,
7776 description: newDescription,
@@ -92,7 +91,7 @@ void main() {
9291 });
9392
9493 test ('returns an identical copy if no updates provided' , () {
95- final originalContent = createSubject ();
94+ final originalContent = createSubject (action : defaultAction );
9695 final copiedContent = originalContent.copyWith ();
9796 expect (copiedContent, originalContent);
9897 expect (identical (copiedContent, originalContent), isFalse);
@@ -101,7 +100,7 @@ void main() {
101100
102101 group ('toJson' , () {
103102 test ('serializes full EngagementContent object to JSON' , () {
104- final content = createSubject ();
103+ final content = createSubject (action : defaultAction );
105104 final json = content.toJson ();
106105
107106 expect (json, < String , dynamic > {
@@ -121,6 +120,7 @@ void main() {
121120 description: null ,
122121 callToActionText: null ,
123122 callToActionUrl: null ,
123+ action: defaultAction,
124124 );
125125 final json = content.toJson ();
126126
@@ -185,19 +185,19 @@ void main() {
185185
186186 group ('Equatable' , () {
187187 test ('instances with same properties are equal' , () {
188- final content1 = createSubject (id: '1' );
189- final content2 = createSubject (id: '1' );
188+ final content1 = createSubject (id: '1' , action : defaultAction );
189+ final content2 = createSubject (id: '1' , action : defaultAction );
190190 expect (content1, content2);
191191 });
192192
193193 test ('instances with different properties are not equal' , () {
194- final content1 = createSubject (id: '1' );
195- final content2 = createSubject (id: '2' );
194+ final content1 = createSubject (id: '1' , action : defaultAction );
195+ final content2 = createSubject (id: '2' , action : defaultAction );
196196 expect (content1, isNot (equals (content2)));
197197 });
198198
199199 test ('props list contains all relevant fields' , () {
200- final content = createSubject ();
200+ final content = createSubject (action : defaultAction );
201201 expect (content.props, [
202202 content.id,
203203 content.title,
0 commit comments