Skip to content
Permalink
Browse files

Fixed the unit tests

  • Loading branch information...
cedx committed Mar 24, 2019
1 parent 432edf8 commit 10baa2539f98cedac42a26f3b96ec721001e61ff
Showing with 0 additions and 106 deletions.
  1. +0 −15 test/configuration_test.dart
  2. +0 −53 test/git_test.dart
  3. +0 −21 test/job_test.dart
  4. +0 −17 test/source_file_test.dart
@@ -111,19 +111,4 @@ void main() => group('Configuration', () {
expect(map['bar'], 'baz');
});
});

group('.toString()', () {
final data = Configuration({'foo': 'bar', 'baz': 'qux'}).toString();

test('should start with the class name', () {
expect(data.indexOf('Configuration {'), 0);
});

test('should contain the instance properties', () {
expect(data, allOf(
contains('"foo":"bar"'),
contains('"baz":"qux"')
));
});
});
});
@@ -51,26 +51,6 @@ void main() => group('GitCommit', () {
expect(map['message'], 'Hello World!');
});
});

group('.toString()', () {
final data = const GitCommit(
'2ef7bde608ce5404e97d5f042f95f89f1c232871',
authorEmail: 'anonymous@secret.com',
authorName: 'Anonymous',
message: 'Hello World!'
).toString();

test('should start with the class name', () {
expect(data.indexOf('GitCommit {'), 0);
});

test('should contain the instance properties', () {
expect(data, contains('"author_email":"anonymous@secret.com"'));
expect(data, contains('"author_name":"Anonymous"'));
expect(data, contains('"id":"2ef7bde608ce5404e97d5f042f95f89f1c232871"'));
expect(data, contains('"message":"Hello World!"'));
});
});
});

group('GitData', () {
@@ -143,24 +123,6 @@ void main() => group('GitCommit', () {
expect(map['remotes'].first['name'], 'origin');
});
});

group('.toString()', () {
final data = GitData(
const GitCommit('2ef7bde608ce5404e97d5f042f95f89f1c232871'),
branch: 'develop',
remotes: [GitRemote('origin')]
).toString();

test('should start with the class name', () {
expect(data.indexOf('GitData {'), 0);
});

test('should contain the instance properties', () {
expect(data, contains('"branch":"develop"'));
expect(data, contains('"head":{'));
expect(data, contains('"remotes":[{'));
});
});
});

group('GitRemote', () {
@@ -197,20 +159,5 @@ void main() => group('GitCommit', () {
expect(map['url'], 'https://github.com/cedx/coveralls.dart.git');
});
});

group('.toString()', () {
final data = GitRemote('origin', 'git@github.com:cedx/coveralls.dart.git').toString();

test('should start with the class name', () {
expect(data.indexOf('GitRemote {'), 0);
});

test('should contain the instance properties', () {
expect(data, allOf(contains('"name":"origin"'), contains('"url":"ssh://git@github.com/cedx/coveralls.dart.git"')));

final httpRemote = GitRemote('origin', Uri.https('github.com', '/cedx/coveralls.dart.git')).toString();
expect(httpRemote, contains('"url":"https://github.com/cedx/coveralls.dart.git"'));
});
});
});
});
@@ -68,25 +68,4 @@ void main() => group('Job', () {
expect(map['source_files'].first['name'], '/home/cedx/coveralls.dart');
});
});

group('.toString()', () {
final job = Job(repoToken: 'yYPv4mMlfjKgUK0rJPgN0AwNXhfzXpVwt')
..git = GitData(null, branch: 'develop')
..isParallel = true
..runAt = DateTime.parse('2017-01-29T02:43:30.000Z')
..sourceFiles.add(SourceFile('/home/cedx/coveralls.dart', ''));

final data = job.toString();
test('should start with the class name', () {
expect(data.indexOf('Job {'), 0);
});

test('should contain the instance properties', () {
expect(data, contains('"git":{'));
expect(data, contains('"parallel":true'));
expect(data, contains('"repo_token":"yYPv4mMlfjKgUK0rJPgN0AwNXhfzXpVwt"'));
expect(data, contains('"run_at":"2017-01-29T02:43:30.000Z"'));
expect(data, contains('"source_files":[{'));
});
});
});
@@ -54,21 +54,4 @@ void main() => group('SourceFile', () {
expect(map['source_digest'], '27f5ebf0f8c559b2af9419d190299a5e');
});
});

group('.toString()', () {
final data = SourceFile('coveralls.dart', '27f5ebf0f8c559b2af9419d190299a5e',
coverage: [null, 2, 0, null, 4, 15, null],
source: 'void main() {}'
).toString();

test('should start with the class name', () {
expect(data.indexOf('SourceFile {'), 0);
});

test('should contain the instance properties', () {
expect(data, contains('"name":"coveralls.dart"'));
expect(data, contains('"source":"void main() {}"'));
expect(data, contains('"source_digest":"27f5ebf0f8c559b2af9419d190299a5e"'));
});
});
});

0 comments on commit 10baa25

Please sign in to comment.
You can’t perform that action at this time.