Skip to content

Commit 0978e48

Browse files
authored
Merge pull request #120 from eviltester/45-full-abstraction-around-faker-to-prevent-need-to-dynamically-delegate
45 full abstraction around faker to prevent need to dynamically delegate
2 parents 7a82d4c + e867f50 commit 0978e48

229 files changed

Lines changed: 18474 additions & 881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ test-results
1414
.tmp-pack
1515
apps/web/dist
1616
apps/web/dist/
17+
.agentic-qe
18+
.tmp
19+
.claude
20+
.pet-runs

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,33 @@ A `rule` can be a regex string e.g.
8989
- `(connie|bob)` which would generate 'connie' or 'bob'
9090
- `[1-9][0-9]{0,4}` which would generate number between 1 and 99999
9191

92-
A `rule` can also be a faker API call.
92+
A `rule` can also be a domain mapped faker API call.
9393

9494
Faker API can be found here: https://fakerjs.dev/api/
9595

9696
e.g.
9797

98-
- `faker.person.firstName`
99-
- `faker.hacker.noun`
98+
```
99+
First Name
100+
awd.domain.person.firstName
101+
102+
Noun
103+
domain.hacker.noun
104+
```
100105

101-
The `faker` prefix is optional:
106+
The `awd` and `domain` prefixes are optional:
102107

103108
e.g.
104109

105-
- `person.firstName`
106-
- `hacker.noun`
110+
```
111+
First Name
112+
person.firstName
113+
114+
Noun
115+
hacker.noun
116+
```
107117

108-
The `fake` method is also supported, which takes a mustache template style string combining api methods e.g.
118+
The `fake` method on faker is also supported, which takes a mustache template style string combining api methods e.g.
109119

110120
- `helpers.fake("{{name.lastName}}, {{name.firstName}}")`
111121

@@ -118,7 +128,7 @@ helpers.fake("{{name.lastName}}, {{name.firstName}}")
118128
119129
# profile text
120130
desc
121-
faker.lorem.paragraph
131+
lorem.paragraph
122132
123133
# preference data
124134
collects
@@ -165,8 +175,8 @@ There is a maintained list in the documentation:
165175

166176
## Libraries Used
167177

168-
- [Faker.js](http://marak.github.io/faker.js) for domain api
169-
- http://marak.github.io/faker.js
178+
- [Faker.js](https://fakerjs.dev/) for backing the domain api
179+
- https://fakerjs.dev/
170180
- [RandExp.js](http://fent.github.io/randexp.js/) for regular expression based random data generation
171181
- http://fent.github.io/randexp.js/
172182
- [Tabulator](https://tabulator.info/) for light weight tables

apps/api/src/api-service.generate.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ describe('api-service handleGenerateRequest', () => {
142142
const { service, setGlobalUnsafe } = createConcreteService({ unsafeEnabled: false });
143143

144144
const safeResult = service.handleGenerateRequest({
145-
body: { textSpec: 'Name\nfaker.person.firstName', rowCount: 1, outputFormat: 'csv' },
145+
body: { textSpec: 'Name\nperson.firstName', rowCount: 1, outputFormat: 'csv' },
146146
});
147147
expect(safeResult.statusCode).toBe(200);
148148

149149
setGlobalUnsafe(true);
150150
const unsafeResult = service.handleGenerateRequest({
151-
body: { textSpec: 'Name\nfaker.person.firstName', rowCount: 1, outputFormat: 'csv' },
151+
body: { textSpec: 'Name\nperson.firstName', rowCount: 1, outputFormat: 'csv' },
152152
});
153153
expect(unsafeResult.statusCode).toBe(200);
154154
});

apps/cli/src/run-cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export async function runCliCommand({ options, platform }) {
171171
if (writer && !writerClosed) {
172172
try {
173173
await writer.close();
174-
} catch (_error) {
174+
} catch {
175175
// Ignore secondary close errors; primary failure is already reported.
176176
}
177177
}

apps/cli/src/tests/integration.cli-output.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test('integration: writes generated content to file and keeps stdout progress-on
4545
} finally {
4646
try {
4747
await fs.unlink(outputPath);
48-
} catch (_error) {
48+
} catch {
4949
// Ignore missing file cleanup races.
5050
}
5151
}

apps/cli/src/tests/integration.cli-params.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ afterAll(async () => {
3232
[...tempPaths].map(async (tempPath) => {
3333
try {
3434
await fs.unlink(tempPath);
35-
} catch (_error) {
35+
} catch {
3636
// Ignore missing files or cleanup race conditions.
3737
}
3838
})

apps/mcp/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ function handleRequest(request) {
294294
textSpec: {
295295
type: 'string',
296296
description:
297-
'Examples:\nName\\nperson.firstName\\nSurname\\nperson.lastName\nor\nname: faker.person.firstName()\nlast_name: person.lastName',
297+
'Examples:\nName\\nperson.firstName\\nSurname\\nperson.lastName\nor\nname: person.firstName()\nlast_name: person.lastName',
298298
},
299299
rowCount: { type: 'integer', minimum: 0 },
300300
outputFormat: { type: 'string', enum: SUPPORTED_FORMATS },

apps/mcp/src/mcp.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ test('MCP server accepts key/value style textSpec for faker rules', () => {
177177
params: {
178178
name: 'generate_data_from_spec',
179179
arguments: {
180-
textSpec: 'first_name: faker.person.firstName()\nlast_name: person.lastName',
180+
textSpec: 'first_name: person.firstName()\nlast_name: person.lastName',
181181
rowCount: 2,
182182
outputFormat: 'json',
183183
},

apps/web/app.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@
6464
<li>[Clear Filters] will clear the quick filter and all column filters</li>
6565
<li>Test Data can be generated by adding a set of (rulename \n rule) in text box</li>
6666
<li>Adding a number of rows to generate and clicking [Generate] button</li>
67-
<li>Rule can be a RegEx expression or a faker API call e.g. (Connie|Bob) or faker.name.firstName</li>
67+
<li>Rule can be a RegEx expression or a domain or faker API call e.g. (Connie|Bob) or name.firstName</li>
6868
</ul>
6969
<button type="button" class="instructions-copy-to-grid-button">Copy Instructions To Grid</button>
7070
<div class="footer">
7171
<p>
72-
v20220801.001 Built by
72+
v20260519.001 Built by
7373
<a href="https://eviltester.com" target="_blank" rel="noopener noreferrer">Alan Richardson</a>
7474
</p>
7575
<p>

apps/web/src/tests/browser/app-coverage/column-operations/column-operations.spec.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)