blob: ae3a195a41f25ce7f4634e7e84f9eeb081b6dddc [file] [log] [blame]
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. 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:firehose/src/github.dart';
import 'package:github/github.dart';
import 'package:test/test.dart';
Future<void> main() async {
var github = GithubApi(
repoSlug: RepositorySlug('dart-lang', 'ecosystem'),
issueNumber: 148,
);
test('Fetching pull request description', () async {
var pullrequestDescription = await github.pullrequestBody();
expect(
pullrequestDescription,
startsWith(
'Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.4 to 4.3.0.\n'));
});
test('Listing files for PR', () async {
var files = await github.listFilesForPR();
expect(files, [
GitFile('.github/workflows/pull_request_label.yml', FileStatus.modified),
]);
});
test('Find comment', () async {
var commentId = await github.findCommentId(user: 'auto-submit[bot]');
expect(commentId?.id, 1660891263);
});
test('Find comment with searchterm', () async {
var commentId = await github.findCommentId(
user: 'auto-submit[bot]',
searchTerm: 'before re-applying this label.',
);
expect(commentId?.id, 1660891263);
});
test('Find comment with searchterm', () async {
var commentId = await github.findCommentId(
user: 'auto-submit[bot]',
searchTerm: 'some string not in the comment',
);
expect(commentId, isNull);
});
tearDownAll(() => github.close());
}