Skip to content

Commit

Permalink
chore: Patched #56
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlee2 committed Jul 26, 2023
1 parent a5c0287 commit ae92f13
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +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. [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. [Step 1: Update acceptance tests (Part 1)](./04-step-1-update-acceptance-tests-part-1.md)
1. [Step 1: Update acceptance tests (Part 2)](./05-step-1-update-acceptance-tests-part-2.md)
1. [Step 2: Update integration tests](./06-step-2-update-integration-tests.md)
1. [Step 3: Update unit tests](./07-step-3-update-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-step-1-acceptance-tests-part-1.md">Step 1: Acceptance tests (Part 1)</a>
Next: <a href="./04-step-1-update-acceptance-tests-part-1.md">Step 1: Update 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 @@
# Step 1: Acceptance tests (Part 1)
# Step 1: Update 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 @@ -87,9 +87,13 @@ We'll create a step called `rename-acceptance-tests`. By the end of this chapter
Don't forget to practice running `lint`, `lint:fix`, and `test`.


### Scaffold the step
### Export an empty function

In the `src/steps` folder, create a file called `rename-acceptance-tests.ts`. The file exports a function that is named `renameAcceptanceTests` (camelized) and receives `options` as an argument.
In the `src/steps` folder, create a file called `rename-acceptance-tests.ts`.

1. The file exports an empty function named `renameAcceptanceTests()` (camelized).
1. The function receives 1 argument, `options`.
1. The type for `options` is defined in `'../types/index.js`.

<details>

Expand Down Expand Up @@ -133,7 +137,6 @@ export function runCodemod(codemodOptions: CodemodOptions): void {
- // ...
+ renameAcceptanceTests(options);
}

```

</details>
Expand Down Expand Up @@ -210,7 +213,7 @@ See if you can do a for-loop over `filePaths`. For each file path:

1. Use `join()` to form the absolute file path.
1. Use `readFileSync()` to read the file content.
1. Use `writeFileSync()` to write the content back to the file (a no-op).
1. Use `writeFileSync()` to write the content back to the file (an **identity function**, which is a no-op).

The `test` script should continue to pass.

Expand Down Expand Up @@ -300,7 +303,7 @@ export function renameAcceptanceTests(options: Options): void {

<div align="center">
<div>
Next: <a href="./05-step-1-acceptance-tests-part-2.md">Step 1: Acceptance tests (Part 2)</a>
Next: <a href="./05-step-1-update-acceptance-tests-part-2.md">Step 1: Update acceptance tests (Part 2)</a>
</div>
<div>
Previous: <a href="./03-sketch-out-the-solution.md">Sketch out the solution</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Step 1: Acceptance tests (Part 2)
# Step 1: Update acceptance tests (Part 2)

By the end of [the last chapter](./04-step-1-acceptance-tests-part-1.md), we extracted a function called `renameModule()`. It received an input file (a file that may or may not be a valid acceptance test) and returned it unchanged.
By the end of [the last chapter](./04-step-1-update-acceptance-tests-part-1.md), we extracted a function called `renameModule()`. It received an input file (a file that may or may not be a valid acceptance test) and returned it unchanged.

```ts
function renameModule(file: string): string {
Expand Down Expand Up @@ -729,9 +729,9 @@ The `test` script should now pass.
<div align="center">
<div>
Next: <a href="./06-step-2-integration-tests.md">Step 2: Integration tests</a>
Next: <a href="./06-step-2-update-integration-tests.md">Step 2: Update integration tests</a>
</div>
<div>
Previous: <a href="./04-step-1-acceptance-tests-part-1.md">Step 1: Acceptance tests (Part 1)</a>
Previous: <a href="./04-step-1-update-acceptance-tests-part-1.md">Step 1: Update acceptance tests (Part 1)</a>
</div>
</div>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Step 2: Update integration tests


<div align="center">
<div>
Next: <a href="./07-step-3-update-unit-tests.md">Step 3: Update unit tests</a>
</div>
<div>
Previous: <a href="./05-step-1-update-acceptance-tests-part-2.md">Step 1: Update acceptance tests (Part 2)</a>
</div>
</div>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Step 3: Update unit tests


<div align="center">
<div>
Next: TBA
</div>
<div>
Previous: <a href="./06-step-2-update-integration-tests.md">Step 2: Update integration tests</a>
</div>
</div>

0 comments on commit ae92f13

Please sign in to comment.