olexale / bdd_widget_test

A BDD-style widget testing library
MIT License
101 stars 30 forks source link

When parsing step with both a variable and a grid, the step file is created incorrectly #81

Open daniel-deboeverie-lemon opened 2 months ago

daniel-deboeverie-lemon commented 2 months ago

When you have a line like the following:

Given {"Steve Jobs"} has a visit planned
      | "id"                 | 1                          |
      | "date"               | "2024-05-01T08:00:00.000Z" |
      | "patientFirstName"   | "Tim"                   |
      | "patientLastName"    | "Cook"                 |
      | "patientBirthDate"   | "1938-05-01T00:00:00.000Z" |
      | "sex"                | "MALE"                     |

the created step file looks like this:

/// Usage: {"Steve Jobs"} has a visit planned
Future<void> hasAVisitPlanned(
  WidgetTester tester,
  bdd.DataTable dataTable
) async {}

and the created usage looks like this:

 await hasAVisitPlanned(
            tester,
            "Steve Jobs",
            const bdd.DataTable([
              ["id", 1],
              ["date", "2024-05-01T08:00:00.000Z"],
              ["patientFirstName", "Tim"],
              ["patientLastName", "Cook"],
              ["patientBirthDate", "1938-05-01T00:00:00.000Z"],
              ["sex", "MALE"]
            ]));

The usage is created correctly, but the step file isn't. The step file should instead be something like this:

/// Usage: {"Steve Jobs"} has a visit planned
Future<void> hasAVisitPlanned(
  WidgetTester tester,
  String param1,
  bdd.DataTable dataTable
) async {}