kaliber5 / ember-cli-yadda-opinionated

A radical take on Cucumber
MIT License
3 stars 1 forks source link

Refactor seeding steps #48

Open lolmaus opened 4 years ago

lolmaus commented 4 years ago

Seeding steps are a mess. They are inconsistent and hard to grasp.

Also, this should be extracted into a converter:

    const typePlural = pluralize(camelize(typeRaw));
    assert(`Collection ${typePlural} does not exist in Mirage`, server.db[typePlural]);
simonihmig commented 4 years ago

What do you have in mind as an alternative?

lolmaus commented 4 years ago
  1. Make it obvious from the step text whether the step accepts a raw JSON input or a table.
  2. Remove relationship lookup from tables and instead use productIds pseudo-attrs.
  3. Provide single-line and multi-line versions of JSON-driven steps.
  4. Less confusing documentation.
lolmaus commented 4 years ago
  1. Remove the @id special format.
lolmaus commented 4 years ago

Previously, I've been trying to kill two birds with one stone: simplicity and readability. It was a limited success and I'm not happy with the quirks our seeding steps have.

Thus, I want to remove all the magic from the existing seeding steps, as described above, and focus on simplicity.

For readability, I have created a separate issue: #49. Set it to the farther milestone, since it's not a priority for us. Might make sense to remove it from the milestone.