From ec72610378458ae9284e340b78850e95783a414b Mon Sep 17 00:00:00 2001 From: Myles Moylan <69246223+moylanm@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:21:28 -0700 Subject: [PATCH] Add simple unit tests for annotations.dart file (#128902) This PR is adding a file of two simple unit tests in order to improve code coverage (covering two simple classes within the annotations.dart file). The issue this is fixing is the lack of complete test coverage for the annotations.dart file. --- .../test/foundation/annotations_test.dart | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/flutter/test/foundation/annotations_test.dart diff --git a/packages/flutter/test/foundation/annotations_test.dart b/packages/flutter/test/foundation/annotations_test.dart new file mode 100644 index 0000000000..9ac272ebcc --- /dev/null +++ b/packages/flutter/test/foundation/annotations_test.dart @@ -0,0 +1,27 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('test Category constructor', () { + const List sections = [ + 'First section', + 'Second section', + 'Third section' + ]; + const Category category = Category(sections); + expect(category.sections, sections); + }); + test('test DocumentationIcon constructor', () { + const DocumentationIcon docIcon = DocumentationIcon('Test String'); + expect(docIcon.url, contains('Test String')); + }); + + test('test Summary constructor', () { + const Summary summary = Summary('Test String'); + expect(summary.text, contains('Test String')); + }); +}