seedIssue method

FakeIssue seedIssue(
  1. String slug, {
  2. required String title,
  3. String body = '',
  4. Set<String> labels = const {},
  5. String state = 'open',
})

Creates an issue directly — the fixture path, and the way a test plays the part of a human who opened the issue in the GitHub UI.

Implementation

FakeIssue seedIssue(
  String slug, {
  required String title,
  String body = '',
  Set<String> labels = const {},
  String state = 'open',
}) {
  final r = repo(slug);
  final number = r.nextIssueNumber++;
  final at = _now;
  final issue = FakeIssue(
    number: number,
    nodeId: 'I_${slug}_$number',
    title: title,
    body: body,
    author: actor,
    createdAt: at,
    updatedAt: at,
    state: state,
    labels: {...labels},
  );
  r.labels.addAll(labels);
  r.issues[number] = issue;
  return issue;
}