Last active
January 9, 2020 05:03
-
-
Save rafdls/75aaf2c363e5a1adc150b4884ec50f8d to your computer and use it in GitHub Desktop.
flutter unit test basics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_test/flutter_test.dart'; | |
void main() { | |
group('This list of numbers', () { | |
List numberList = [1, 2, 3, 4, 5]; | |
test('should have the right length', () { | |
expect(numberList.length, equals(5)); | |
}); | |
test('should have the correct order', () { | |
expect(numberList, orderedEquals([1, 2, 3, 4, 5])); | |
}); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_test/flutter_test.dart'; | |
void main() { | |
test('my first test', () { | |
expect(2, equals(2)); | |
}); | |
test('item should be in list', () { | |
expect([1, 2, 3, 4], contains(2)); | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment