declapract-typescript-ehmpathy 0.47.20 → 0.47.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## .what
4
4
 
5
- detects test files located in `acceptance/` directory and migrates them to `blackbox/`.
5
+ detects test files located in `acceptance/` or `accept.blackbox/` directories and migrates them to `blackbox/`.
6
6
 
7
7
  ## .why
8
8
 
@@ -11,11 +11,11 @@ the term "blackbox" makes the testing philosophy explicit:
11
11
  - no access to internal implementation details
12
12
  - tests validate behavior from the caller's perspective
13
13
 
14
- the rename from `acceptance/` to `blackbox/` clarifies this intent.
14
+ the rename from `acceptance/` or `accept.blackbox/` to `blackbox/` clarifies this intent and simplifies the naming.
15
15
 
16
16
  ## .fix
17
17
 
18
- moves all files from `acceptance/` to `blackbox/` while preserving the directory structure.
18
+ moves all files from `acceptance/` or `accept.blackbox/` to `blackbox/` while preserving the directory structure.
19
19
 
20
20
  ## .note
21
21
 
@@ -0,0 +1,19 @@
1
+ import { FileCheckType, type FileFixFunction } from 'declapract';
2
+
3
+ export const check = FileCheckType.EXISTS; // if any ts files exist in accept.blackbox/, flag as bad practice
4
+
5
+ /**
6
+ * .what = moves ts files from accept.blackbox/ to blackbox/
7
+ * .why = blackbox/ naming is simpler and makes the testing philosophy explicit
8
+ */
9
+ export const fix: FileFixFunction = (contents, context) => {
10
+ // move from accept.blackbox/ to blackbox/
11
+ const newPath = context.relativeFilePath.replace(
12
+ /^accept\.blackbox\//,
13
+ 'blackbox/',
14
+ );
15
+ return {
16
+ contents: contents ?? null,
17
+ relativeFilePath: newPath,
18
+ };
19
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "declapract-typescript-ehmpathy",
3
3
  "author": "ehmpathy",
4
4
  "description": "declapract best practices declarations for typescript",
5
- "version": "0.47.20",
5
+ "version": "0.47.21",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
8
8
  "repository": "ehmpathy/declapract-typescript-ehmpathy",