Skip to content

Commit

Permalink
Add tutorial (Part 5) (#56)
Browse files Browse the repository at this point in the history
* chore: Patched #55

* Added chapter (create-the-first-step-part-2)

* chore: Renamed files and added placeholder files for future chapters

---------

Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
  • Loading branch information
ijlee2 and ijlee2 authored Jul 26, 2023
1 parent d134348 commit a5c0287
Show file tree
Hide file tree
Showing 7 changed files with 769 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ The codemod is practical (i.e. end-developers can now use `--filter` to run a gr
1. [Create a project](./01-create-a-project.md)
1. [Understand the folder structure](./02-understand-the-folder-structure.md)
1. [Sketch out the solution](./03-sketch-out-the-solution.md)
1. [Create the first step (Part 1)](./04-create-the-first-step-part-1.md)
1. [Create the first step (Part 2)](./05-create-the-first-step-part-2.md)
1. [Step 1: Acceptance tests (Part 1)](./04-step-1-acceptance-tests-part-1.md)
1. [Step 1: Acceptance tests (Part 2)](./05-step-1-acceptance-tests-part-2.md)
1. [Step 2: Integration tests](./06-step-2-integration-tests.md)
1. [Step 3: Unit tests](./07-step-3-unit-tests.md)
1. ...
1. Maintain the project
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function runCodemod(codemodOptions: CodemodOptions): void {

<div align="center">
<div>
Next: <a href="./04-create-the-first-step-part-1.md">Create the first step (Part 1)</a>
Next: <a href="./04-step-1-acceptance-tests-part-1.md">Step 1: Acceptance tests (Part 1)</a>
</div>
<div>
Previous: <a href="./02-understand-the-folder-structure.md">Understand the folder structure</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Create the first step (Part 1)
# Step 1: Acceptance tests (Part 1)

So far, we used the CLI to [scaffold a project](./01-create-a-project.md) and came up with [3 steps to make test module names consistent](./03-sketch-out-the-solution.md):

Expand Down Expand Up @@ -71,13 +71,11 @@ For this tutorial, you can cherry-pick [the 3rd commit from my solution repo](ht
```sh
git remote add solution git@github.com:ijlee2/ember-codemod-rename-test-modules.git
git fetch solution

# Cherry-pick the 3rd commit (chore: Added a fixture project)
git cherry-pick 5a354a4
git remote remove solution
```

Have a look at the files in `tests/fixtures/sample-project/input` ("input project"). You will find that the test module names are wildly inconsistent. The files in `tests/fixtures/sample-project/output` ("output project") are the same as those from the input project (for now).
Have a look at the files in `tests/fixtures/sample-project/input` ("input project"). You will find that the test module names are wildly inconsistent. The files in `tests/fixtures/sample-project/output` ("output project") are, for now, the same as those from the input project.

Since our codemod is a no-op and the input and output are the same, we expect the `test` script to pass. Indeed, this is the case.

Expand Down Expand Up @@ -181,12 +179,13 @@ Note how I logged `filePaths` to check what `findFiles()` returns. You can run t

<details>

<summary>Expected output</code></summary>
<summary>Expected output</summary>

Note, the array appears twice, because an acceptance test runs the codemod twice to assert idempotency.

```sh
❯ pnpm test

[
'tests/acceptance/form-test.ts',
'tests/acceptance/index-test.ts',
Expand Down Expand Up @@ -301,7 +300,7 @@ export function renameAcceptanceTests(options: Options): void {

<div align="center">
<div>
Next: <a href="./05-create-the-first-step-part-1.md">Create the first step (Part 2)</a>
Next: <a href="./05-step-1-acceptance-tests-part-2.md">Step 1: Acceptance tests (Part 2)</a>
</div>
<div>
Previous: <a href="./03-sketch-out-the-solution.md">Sketch out the solution</a>
Expand Down

This file was deleted.

Loading

0 comments on commit a5c0287

Please sign in to comment.