rhachet-roles-ehmpathy 1.3.0 → 1.6.0
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.
- package/dist/contract/sdk/index.d.ts +1 -0
- package/dist/contract/sdk/index.js +3 -1
- package/dist/contract/sdk/index.js.map +1 -1
- package/dist/logic/artifact/genStepArtDel.d.ts +17 -0
- package/dist/logic/artifact/genStepArtDel.js +29 -0
- package/dist/logic/artifact/genStepArtDel.js.map +1 -0
- package/dist/logic/artifact/setSkillOutputSrc.d.ts +32 -0
- package/dist/logic/artifact/setSkillOutputSrc.js +99 -0
- package/dist/logic/artifact/setSkillOutputSrc.js.map +1 -0
- package/dist/logic/hooks/decodeDocOutputPath.d.ts +21 -0
- package/dist/logic/hooks/decodeDocOutputPath.js +57 -0
- package/dist/logic/hooks/decodeDocOutputPath.js.map +1 -0
- package/dist/logic/hooks/decodeDocOutputPath.test.d.ts +1 -0
- package/dist/logic/hooks/decodeDocOutputPath.test.js +146 -0
- package/dist/logic/hooks/decodeDocOutputPath.test.js.map +1 -0
- package/dist/logic/hooks/execTranslateDocOutputPath.d.ts +20 -0
- package/dist/logic/hooks/execTranslateDocOutputPath.js +80 -0
- package/dist/logic/hooks/execTranslateDocOutputPath.js.map +1 -0
- package/dist/logic/hooks/execTranslateDocOutputPath.test.d.ts +1 -0
- package/dist/logic/hooks/execTranslateDocOutputPath.test.js +409 -0
- package/dist/logic/hooks/execTranslateDocOutputPath.test.js.map +1 -0
- package/dist/logic/hooks/getInvokeHooks.d.ts +2 -0
- package/dist/logic/hooks/getInvokeHooks.js +15 -0
- package/dist/logic/hooks/getInvokeHooks.js.map +1 -0
- package/dist/logic/hooks/relateDocOutputPath.d.ts +10 -0
- package/dist/logic/hooks/relateDocOutputPath.js +45 -0
- package/dist/logic/hooks/relateDocOutputPath.js.map +1 -0
- package/dist/logic/hooks/relateDocOutputPath.test.d.ts +1 -0
- package/dist/logic/hooks/relateDocOutputPath.test.js +111 -0
- package/dist/logic/hooks/relateDocOutputPath.test.js.map +1 -0
- package/dist/logic/roles/bhrain/.briefs/knowledge/kno501.doc.enbrief.catalog.structure1.[lesson].template.md +3 -3
- package/dist/logic/roles/bhrain/brief.articulate/stepArticulate.skill.js +3 -0
- package/dist/logic/roles/bhrain/brief.articulate/stepArticulate.skill.js.map +1 -1
- package/dist/logic/roles/bhrain/brief.catalogize/stepCatalogize.skill.js +8 -2
- package/dist/logic/roles/bhrain/brief.catalogize/stepCatalogize.skill.js.map +1 -1
- package/dist/logic/roles/bhrain/getBhrainBrief.Options.codegen.d.ts +1 -1
- package/dist/logic/roles/bhrain/getBhrainBrief.Options.codegen.js +58 -36
- package/dist/logic/roles/bhrain/getBhrainBrief.Options.codegen.js.map +1 -1
- package/dist/logic/roles/bhrain/getBhrainRole.js +6 -0
- package/dist/logic/roles/bhrain/getBhrainRole.js.map +1 -1
- package/dist/logic/roles/bhrain/khue.instantiate/stepInstantiate.skill.js +22 -2
- package/dist/logic/roles/bhrain/khue.instantiate/stepInstantiate.skill.js.map +1 -1
- package/dist/logic/roles/ecologist/getEcologistBrief.Options.codegen.d.ts +1 -1
- package/dist/logic/roles/ecologist/getEcologistBrief.Options.codegen.js +14 -14
- package/dist/logic/roles/ecologist/getEcologistBrief.Options.codegen.js.map +1 -1
- package/dist/logic/roles/getRoleRegistry.js +2 -0
- package/dist/logic/roles/getRoleRegistry.js.map +1 -1
- package/dist/logic/roles/mechanic/.briefs/terms/plan.exec_vs_apply.md +45 -0
- package/dist/logic/roles/mechanic/getMechanicBrief.Options.codegen.d.ts +1 -1
- package/dist/logic/roles/mechanic/getMechanicBrief.Options.codegen.js +1 -0
- package/dist/logic/roles/mechanic/getMechanicBrief.Options.codegen.js.map +1 -1
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.d.ts +42 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.d.ts +1 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.js +76 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.js.map +1 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.js +126 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.js.map +1 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.d.ts +12 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.js +69 -0
- package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.js.map +1 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.d.ts +54 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.d.ts +1 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.js +97 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.js.map +1 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.js +68 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.js.map +1 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.skill.d.ts +28 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.skill.js +124 -0
- package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.skill.js.map +1 -0
- package/dist/logic/roles/terminal.commander/getCommanderRole.d.ts +2 -0
- package/dist/logic/roles/terminal.commander/getCommanderRole.js +35 -0
- package/dist/logic/roles/terminal.commander/getCommanderRole.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
4
|
+
const test_fns_1 = require("test-fns");
|
|
5
|
+
const execTranslateDocOutputPath_1 = require("./execTranslateDocOutputPath");
|
|
6
|
+
const context = {
|
|
7
|
+
log: console,
|
|
8
|
+
};
|
|
9
|
+
describe('execTranslateDocOutputPath (integration; hard-coded expectations)', () => {
|
|
10
|
+
(0, test_fns_1.given)('opts.output is not a string', () => {
|
|
11
|
+
const input = { output: undefined };
|
|
12
|
+
(0, test_fns_1.when)('executed', () => {
|
|
13
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
14
|
+
(0, test_fns_1.then)('it returns opts unchanged', () => {
|
|
15
|
+
expect(result).toBe(input);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
(0, test_fns_1.given)('opts.output is a string but not an @translate(...) call', () => {
|
|
20
|
+
const input = { output: 'hello.md', references: 'foo' };
|
|
21
|
+
(0, test_fns_1.when)('executed', () => {
|
|
22
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
23
|
+
(0, test_fns_1.then)('it returns opts unchanged', () => {
|
|
24
|
+
expect(result).toBe(input);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
(0, test_fns_1.given)('opts.output is @translate(...) but not references.0', () => {
|
|
29
|
+
const input = {
|
|
30
|
+
output: '@translate(references.1).as(story)',
|
|
31
|
+
references: 'src/a.[stories].v1.i2.md',
|
|
32
|
+
};
|
|
33
|
+
(0, test_fns_1.when)('executed', () => {
|
|
34
|
+
const err = (0, test_fns_1.getError)(() => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context));
|
|
35
|
+
(0, test_fns_1.then)('it throws a BadRequestError', () => {
|
|
36
|
+
expect(err).toBeInstanceOf(helpful_errors_1.BadRequestError);
|
|
37
|
+
expect(err.message).toMatch(/unsupported @translation source/i);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
(0, test_fns_1.given)('opts.output is @translate(references.0) but missing .as(doctype)', () => {
|
|
42
|
+
const input = {
|
|
43
|
+
output: '@translate(references.0)',
|
|
44
|
+
references: 'src/a.[stories].v1.i2.md',
|
|
45
|
+
};
|
|
46
|
+
(0, test_fns_1.when)('executed', () => {
|
|
47
|
+
const err = (0, test_fns_1.getError)(() => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context));
|
|
48
|
+
(0, test_fns_1.then)('it throws an UnexpectedCodePathError', () => {
|
|
49
|
+
expect(err).toBeInstanceOf(helpful_errors_1.UnexpectedCodePathError);
|
|
50
|
+
expect(err.message).toMatch(/\.as\(doctype\) was not part of output/i);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
(0, test_fns_1.given)('opts.references is not a string', () => {
|
|
55
|
+
const input = {
|
|
56
|
+
output: '@translate(references.0).as(story)',
|
|
57
|
+
references: ['not-a-string'],
|
|
58
|
+
};
|
|
59
|
+
(0, test_fns_1.when)('executed', () => {
|
|
60
|
+
const err = (0, test_fns_1.getError)(() => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context));
|
|
61
|
+
(0, test_fns_1.then)('it throws a BadRequestError', () => {
|
|
62
|
+
expect(err).toBeInstanceOf(helpful_errors_1.BadRequestError);
|
|
63
|
+
expect(err.message).toMatch(/opts\.references is not a string/i);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
(0, test_fns_1.given)('opts.references is an empty string', () => {
|
|
68
|
+
const input = {
|
|
69
|
+
output: '@translate(references.0).as(story)',
|
|
70
|
+
references: '',
|
|
71
|
+
};
|
|
72
|
+
(0, test_fns_1.when)('executed', () => {
|
|
73
|
+
const err = (0, test_fns_1.getError)(() => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context));
|
|
74
|
+
(0, test_fns_1.then)('it throws a BadRequestError', () => {
|
|
75
|
+
expect(err).toBeInstanceOf(helpful_errors_1.BadRequestError);
|
|
76
|
+
expect(err.message).toMatch(/opts\.references is not a string/i);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
(0, test_fns_1.given)('happy path: both variant and instance after the source [doctype]', () => {
|
|
81
|
+
// note: prefix should drop any trailing dot before composing
|
|
82
|
+
const source = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
83
|
+
'provider.plumber_pete.customer.scene_6.build.persp_pro.v2i3.[stories].v5.i7.md';
|
|
84
|
+
const input = {
|
|
85
|
+
output: '@translate(references.0).as(story)',
|
|
86
|
+
references: `${source},other/ignored.md`,
|
|
87
|
+
};
|
|
88
|
+
(0, test_fns_1.when)('executed', () => {
|
|
89
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
90
|
+
(0, test_fns_1.then)('it preserves vNiN before new [doctype], sets v1 after, and keeps extension', () => {
|
|
91
|
+
const expectedPrefix = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
92
|
+
'provider.plumber_pete.customer.scene_6.build.persp_pro.v2i3';
|
|
93
|
+
const expected = `${expectedPrefix}.v5i7.[story].v1.md`;
|
|
94
|
+
expect(result.output).toBe(expected);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
(0, test_fns_1.given)('only variant exists after the source [doctype]', () => {
|
|
99
|
+
const source = 'x/y/z/topic.v9.[notes].v12.md';
|
|
100
|
+
const input = {
|
|
101
|
+
output: '@translate(references.0).as(report)',
|
|
102
|
+
references: source,
|
|
103
|
+
};
|
|
104
|
+
(0, test_fns_1.when)('executed', () => {
|
|
105
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
106
|
+
(0, test_fns_1.then)('it places vN before [doctype], appends .v1.ext', () => {
|
|
107
|
+
const expected = 'x/y/z/topic.v9.v12.[report].v1.md';
|
|
108
|
+
expect(result.output).toBe(expected);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
(0, test_fns_1.given)('only instance exists after the source [doctype]', () => {
|
|
113
|
+
const source = 'x/y/z/topic.[stories].i8.txt';
|
|
114
|
+
const input = {
|
|
115
|
+
output: '@translate(references.0).as(notes)',
|
|
116
|
+
references: source,
|
|
117
|
+
};
|
|
118
|
+
(0, test_fns_1.when)('executed', () => {
|
|
119
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
120
|
+
(0, test_fns_1.then)('it places iN before [doctype], appends .v1.ext', () => {
|
|
121
|
+
const expected = 'x/y/z/topic.i8.[notes].v1.txt';
|
|
122
|
+
expect(result.output).toBe(expected);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
(0, test_fns_1.given)('no versions exist after the source [doctype]', () => {
|
|
127
|
+
const source = 'dir/file.[story].md';
|
|
128
|
+
const input = {
|
|
129
|
+
output: '@translate(references.0).as(stories)',
|
|
130
|
+
references: source,
|
|
131
|
+
};
|
|
132
|
+
(0, test_fns_1.when)('executed', () => {
|
|
133
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
134
|
+
(0, test_fns_1.then)('it emits prefix.[doctype].v1.ext (no vNiN before [doctype])', () => {
|
|
135
|
+
const expected = 'dir/file.[stories].v1.md';
|
|
136
|
+
expect(result.output).toBe(expected);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
(0, test_fns_1.given)('no extension present in the source path', () => {
|
|
141
|
+
const source = 'a/b/c/topic.[stories].v3.i2';
|
|
142
|
+
const input = {
|
|
143
|
+
output: '@translate(references.0).as(summary)',
|
|
144
|
+
references: source,
|
|
145
|
+
};
|
|
146
|
+
(0, test_fns_1.when)('executed', () => {
|
|
147
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
148
|
+
(0, test_fns_1.then)('it omits the trailing dot/extension', () => {
|
|
149
|
+
const expected = 'a/b/c/topic.v3i2.[summary].v1';
|
|
150
|
+
expect(result.output).toBe(expected);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
(0, test_fns_1.given)('a [doctype] earlier in the path should be ignored (must be after last "/")', () => {
|
|
155
|
+
const source = 'a/b.[draft]/c/topic.v1i2.i3.md'; // no [doctype] after last slash
|
|
156
|
+
const input = {
|
|
157
|
+
output: '@translate(references.0).as(story)',
|
|
158
|
+
references: source,
|
|
159
|
+
};
|
|
160
|
+
(0, test_fns_1.when)('executed', () => {
|
|
161
|
+
const err = (0, test_fns_1.getError)(() => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context));
|
|
162
|
+
(0, test_fns_1.then)('it bubbles up the decoder error', () => {
|
|
163
|
+
expect(err).toBeInstanceOf(helpful_errors_1.BadRequestError);
|
|
164
|
+
expect(err.message).toMatch(/could not find any \[doctype]/i);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
(0, test_fns_1.given)('happy path with .ext(json): override source extension', () => {
|
|
169
|
+
const source = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
170
|
+
'provider.plumber_pete.customer.scene_6.build.persp_pro.v2i3.[stories].v5.i7.md';
|
|
171
|
+
const input = {
|
|
172
|
+
output: '@translate(references.0).as(story).ext(json)',
|
|
173
|
+
references: `${source},ignored/also.md`,
|
|
174
|
+
};
|
|
175
|
+
(0, test_fns_1.when)('executed', () => {
|
|
176
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
177
|
+
(0, test_fns_1.then)('it sets the new extension to .json', () => {
|
|
178
|
+
const expectedPrefix = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
179
|
+
'provider.plumber_pete.customer.scene_6.build.persp_pro.v2i3';
|
|
180
|
+
const expected = `${expectedPrefix}.v5i7.[story].v1.json`;
|
|
181
|
+
expect(result.output).toBe(expected);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
(0, test_fns_1.given)('source has no extension; .ext(md) supplies one after translation', () => {
|
|
186
|
+
const source = 'a/b/c/topic.[stories].v3.i2';
|
|
187
|
+
const input = {
|
|
188
|
+
output: '@translate(references.0).as(summary).ext(md)',
|
|
189
|
+
references: source,
|
|
190
|
+
};
|
|
191
|
+
(0, test_fns_1.when)('executed', () => {
|
|
192
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
193
|
+
(0, test_fns_1.then)('it appends .md', () => {
|
|
194
|
+
const expected = 'a/b/c/topic.v3i2.[summary].v1.md';
|
|
195
|
+
expect(result.output).toBe(expected);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
(0, test_fns_1.given)('source has an extension; .ext(md) replaces it with .md consistently', () => {
|
|
200
|
+
const source = 'x/y/z/topic.[stories].i8.txt';
|
|
201
|
+
const input = {
|
|
202
|
+
output: '@translate(references.0).as(notes).ext(md)',
|
|
203
|
+
references: source,
|
|
204
|
+
};
|
|
205
|
+
(0, test_fns_1.when)('executed', () => {
|
|
206
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
207
|
+
(0, test_fns_1.then)('it replaces .txt with .md', () => {
|
|
208
|
+
const expected = 'x/y/z/topic.i8.[notes].v1.md';
|
|
209
|
+
expect(result.output).toBe(expected);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
(0, test_fns_1.given)('only variant exists after [doctype]; .ext(json) still applies .json', () => {
|
|
214
|
+
const source = 'x/y/z/topic.v9.[notes].v12.md';
|
|
215
|
+
const input = {
|
|
216
|
+
output: '@translate(references.0).as(report).ext(json)',
|
|
217
|
+
references: source,
|
|
218
|
+
};
|
|
219
|
+
(0, test_fns_1.when)('executed', () => {
|
|
220
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
221
|
+
(0, test_fns_1.then)('it outputs ...[report].v1.json', () => {
|
|
222
|
+
const expected = 'x/y/z/topic.v9.v12.[report].v1.json';
|
|
223
|
+
expect(result.output).toBe(expected);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('execTranslateDocOutputPath .rel(...) (integration; hard-coded expectations)', () => {
|
|
229
|
+
(0, test_fns_1.given)('move from step_1.translate → ../step_2.format (sibling up)', () => {
|
|
230
|
+
const source = 'src/product/cooltools/tool.hammer/step_1.translate/' +
|
|
231
|
+
'provider.scene_6.build.persp_pro.v2i3.[stories].v5.i7.md';
|
|
232
|
+
const input = {
|
|
233
|
+
output: '@translate(references.0).as(story).rel(../step_2.format)',
|
|
234
|
+
references: source,
|
|
235
|
+
};
|
|
236
|
+
(0, test_fns_1.when)('executed', () => {
|
|
237
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
238
|
+
(0, test_fns_1.then)('it re-roots under step_2.format and composes new file path', () => {
|
|
239
|
+
const expectedPrefix = 'src/product/cooltools/tool.hammer/step_2.format/' +
|
|
240
|
+
'provider.scene_6.build.persp_pro.v2i3';
|
|
241
|
+
const expected = `${expectedPrefix}.v5i7.[story].v1.md`;
|
|
242
|
+
expect(result.output).toBe(expected);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
(0, test_fns_1.given)('append a child dir via .rel(./drafts)', () => {
|
|
247
|
+
const source = 'pkg/flows/step_3.translate/topic.branch.v9.[notes].v12.md';
|
|
248
|
+
const input = {
|
|
249
|
+
output: '@translate(references.0).as(report).rel(./drafts)',
|
|
250
|
+
references: source,
|
|
251
|
+
};
|
|
252
|
+
(0, test_fns_1.when)('executed', () => {
|
|
253
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
254
|
+
(0, test_fns_1.then)('it nests under drafts/', () => {
|
|
255
|
+
const expected = 'pkg/flows/step_3.translate/drafts/topic.branch.v9.v12.[report].v1.md';
|
|
256
|
+
expect(result.output).toBe(expected);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
(0, test_fns_1.given)('pop one directory via .rel(..)', () => {
|
|
261
|
+
const source = 'a/b/topic.[stories].i8.txt';
|
|
262
|
+
const input = {
|
|
263
|
+
output: '@translate(references.0).as(notes).rel(..)',
|
|
264
|
+
references: source,
|
|
265
|
+
};
|
|
266
|
+
(0, test_fns_1.when)('executed', () => {
|
|
267
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
268
|
+
(0, test_fns_1.then)('it moves to a/ and composes there', () => {
|
|
269
|
+
const expected = 'a/topic.i8.[notes].v1.txt';
|
|
270
|
+
expect(result.output).toBe(expected);
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
(0, test_fns_1.given)('combine .rel(...) with .ext(json)', () => {
|
|
275
|
+
const source = 'root/x/item.[story].md';
|
|
276
|
+
const input = {
|
|
277
|
+
output: '@translate(references.0).as(summary).rel(../y).ext(json)',
|
|
278
|
+
references: source,
|
|
279
|
+
};
|
|
280
|
+
(0, test_fns_1.when)('executed', () => {
|
|
281
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
282
|
+
(0, test_fns_1.then)('it re-roots and overrides extension to .json', () => {
|
|
283
|
+
const expected = 'root/y/item.[summary].v1.json';
|
|
284
|
+
expect(result.output).toBe(expected);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
(0, test_fns_1.given)('source without extension + .rel(...) keeps no trailing dot unless .ext provided', () => {
|
|
289
|
+
const source = 'docs/step.translate/topic.v3i2.[stories]';
|
|
290
|
+
const input = {
|
|
291
|
+
output: '@translate(references.0).as(summary).rel(../step.out)',
|
|
292
|
+
references: source,
|
|
293
|
+
};
|
|
294
|
+
(0, test_fns_1.when)('executed', () => {
|
|
295
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
296
|
+
(0, test_fns_1.then)('it emits no trailing extension', () => {
|
|
297
|
+
const expected = 'docs/step.out/topic.v3i2.[summary].v1';
|
|
298
|
+
expect(result.output).toBe(expected);
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
describe('execTranslateDocOutputPath .v(n) (integration; hard-coded expectations)', () => {
|
|
304
|
+
(0, test_fns_1.given)('happy path: override starting variant to v2', () => {
|
|
305
|
+
const source = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
306
|
+
'provider.plumber_pete.customer.scene_6.build.persp_pro.v2i3.[stories].v5.i7.md';
|
|
307
|
+
const input = {
|
|
308
|
+
output: '@translate(references.0).as(story).v(2)',
|
|
309
|
+
references: `${source},other/ignored.md`,
|
|
310
|
+
};
|
|
311
|
+
(0, test_fns_1.when)('executed', () => {
|
|
312
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
313
|
+
(0, test_fns_1.then)('it preserves vNiN before [doctype] and sets tail to .v2', () => {
|
|
314
|
+
const expectedPrefix = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
315
|
+
'provider.plumber_pete.customer.scene_6.build.persp_pro.v2i3';
|
|
316
|
+
const expected = `${expectedPrefix}.v5i7.[story].v2.md`;
|
|
317
|
+
expect(result.output).toBe(expected);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
(0, test_fns_1.given)('only instance exists after source [doctype]; override to v3', () => {
|
|
322
|
+
const source = 'x/y/z/topic.[stories].i8.txt';
|
|
323
|
+
const input = {
|
|
324
|
+
output: '@translate(references.0).as(notes).v(3)',
|
|
325
|
+
references: source,
|
|
326
|
+
};
|
|
327
|
+
(0, test_fns_1.when)('executed', () => {
|
|
328
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
329
|
+
(0, test_fns_1.then)('it places iN before [doctype] and appends .v3.ext', () => {
|
|
330
|
+
const expected = 'x/y/z/topic.i8.[notes].v3.txt';
|
|
331
|
+
expect(result.output).toBe(expected);
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
(0, test_fns_1.given)('no versions exist after source [doctype]; override to v4', () => {
|
|
336
|
+
const source = 'dir/file.[story].md';
|
|
337
|
+
const input = {
|
|
338
|
+
output: '@translate(references.0).as(stories).v(4)',
|
|
339
|
+
references: source,
|
|
340
|
+
};
|
|
341
|
+
(0, test_fns_1.when)('executed', () => {
|
|
342
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
343
|
+
(0, test_fns_1.then)('it emits prefix.[doctype].v4.ext', () => {
|
|
344
|
+
const expected = 'dir/file.[stories].v4.md';
|
|
345
|
+
expect(result.output).toBe(expected);
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
(0, test_fns_1.given)('.v(n) with .ext override and preserved vNiN', () => {
|
|
350
|
+
const source = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
351
|
+
'provider.scene_6.build.persp_pro.v2i3.[stories].v5.i7.md';
|
|
352
|
+
const input = {
|
|
353
|
+
output: '@translate(references.0).as(story).v(6).ext(json)',
|
|
354
|
+
references: source,
|
|
355
|
+
};
|
|
356
|
+
(0, test_fns_1.when)('executed', () => {
|
|
357
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
358
|
+
(0, test_fns_1.then)('it outputs ...[story].v6.json (and preserves v5i7 before)', () => {
|
|
359
|
+
const expectedPrefix = 'src/product/cooltools/tool.hammer/step_5.stories/step_1.translate/' +
|
|
360
|
+
'provider.scene_6.build.persp_pro.v2i3';
|
|
361
|
+
const expected = `${expectedPrefix}.v5i7.[story].v6.json`;
|
|
362
|
+
expect(result.output).toBe(expected);
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
(0, test_fns_1.given)('.v(n) combined with .rel(...)', () => {
|
|
367
|
+
const source = 'src/flow/step_1.translate/topic.branch.v9.[notes].v12.md';
|
|
368
|
+
const input = {
|
|
369
|
+
output: '@translate(references.0).as(report).v(2).rel(../step_2.format)',
|
|
370
|
+
references: source,
|
|
371
|
+
};
|
|
372
|
+
(0, test_fns_1.when)('executed', () => {
|
|
373
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
374
|
+
(0, test_fns_1.then)('it re-roots and uses v2 at the tail', () => {
|
|
375
|
+
const expected = 'src/flow/step_2.format/topic.branch.v9.v12.[report].v2.md';
|
|
376
|
+
expect(result.output).toBe(expected);
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
(0, test_fns_1.given)('invalid .v(0) should fail fast', () => {
|
|
381
|
+
const source = 'x/y/z/topic.[stories].i8.txt';
|
|
382
|
+
const input = {
|
|
383
|
+
output: '@translate(references.0).as(notes).v(0)',
|
|
384
|
+
references: source,
|
|
385
|
+
};
|
|
386
|
+
(0, test_fns_1.when)('executed', () => {
|
|
387
|
+
const err = (0, test_fns_1.getError)(() => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context));
|
|
388
|
+
(0, test_fns_1.then)('it throws a BadRequestError about positive integer', () => {
|
|
389
|
+
expect(err).toBeInstanceOf(helpful_errors_1.BadRequestError);
|
|
390
|
+
expect(err.message).toMatch(/\.v\(n\) must be a positive integer/i);
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
(0, test_fns_1.given)('absence of .v(n) defaults to .v1 (control)', () => {
|
|
395
|
+
const source = 'x/y/z/topic.[stories].i8.txt';
|
|
396
|
+
const input = {
|
|
397
|
+
output: '@translate(references.0).as(notes)',
|
|
398
|
+
references: source,
|
|
399
|
+
};
|
|
400
|
+
(0, test_fns_1.when)('executed', () => {
|
|
401
|
+
const result = (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(input, context);
|
|
402
|
+
(0, test_fns_1.then)('it uses v1 at the tail', () => {
|
|
403
|
+
const expected = 'x/y/z/topic.i8.[notes].v1.txt';
|
|
404
|
+
expect(result.output).toBe(expected);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
//# sourceMappingURL=execTranslateDocOutputPath.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execTranslateDocOutputPath.test.js","sourceRoot":"","sources":["../../../src/logic/hooks/execTranslateDocOutputPath.test.ts"],"names":[],"mappings":";;AAAA,mDAA0E;AAC1E,uCAAuD;AAEvD,6EAA0E;AAE1E,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,QAAQ,CAAC,mEAAmE,EAAE,GAAG,EAAE;IACjF,IAAA,gBAAK,EAAC,6BAA6B,EAAE,GAAG,EAAE;QACxC,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAS,CAAC;QAE3C,IAAA,eAAI,EAAC,UAAU,EAAE,GAAG,EAAE;YACpB,MAAM,MAAM,GAAG,IAAA,uDAA0B,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE1D,IAAA,eAAI,EAAC,2BAA2B,EAAE,GAAG,EAAE;gBACrC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,gBAAK,EAAC,yDAAyD,EAAE,GAAG,EAAE;QACpE,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAS,CAAC;QAE/D,IAAA,eAAI,EAAC,UAAU,EAAE,GAAG,EAAE;YACpB,MAAM,MAAM,GAAG,IAAA,uDAA0B,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE1D,IAAA,eAAI,EAAC,2BAA2B,EAAE,GAAG,EAAE;gBACrC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;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AAI,EAAC,UAAU,EAAE,GAAG,EAAE;YACpB,MAAM,MAAM,GAAG,IAAA,uDAA0B,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE1D,IAAA,eAAI,EAAC,wBAAwB,EAAE,GAAG,EAAE;gBAClC,MAAM,QAAQ,GAAG,+BAA+B,CAAC;gBACjD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvokeHooks = void 0;
|
|
4
|
+
const execTranslateDocOutputPath_1 = require("./execTranslateDocOutputPath");
|
|
5
|
+
const getInvokeHooks = () => ({
|
|
6
|
+
onInvokeAskInput: [
|
|
7
|
+
(input) => {
|
|
8
|
+
console.log('🪝 hook ran!');
|
|
9
|
+
return input;
|
|
10
|
+
},
|
|
11
|
+
(opts) => (0, execTranslateDocOutputPath_1.execTranslateDocOutputPath)(opts, { log: console }), // todo: forward log context
|
|
12
|
+
],
|
|
13
|
+
});
|
|
14
|
+
exports.getInvokeHooks = getInvokeHooks;
|
|
15
|
+
//# sourceMappingURL=getInvokeHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInvokeHooks.js","sourceRoot":"","sources":["../../../src/logic/hooks/getInvokeHooks.ts"],"names":[],"mappings":";;;AAEA,6EAA0E;AAEnE,MAAM,cAAc,GAAG,GAAgB,EAAE,CAAC,CAAC;IAChD,gBAAgB,EAAE;QAChB,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,uDAA0B,EAAC,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,4BAA4B;KAC3F;CACF,CAAC,CAAC;AARU,QAAA,cAAc,kBAQxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = computes the relative path, in relation to some relative modifier
|
|
3
|
+
* .how =
|
|
4
|
+
* - path(path/to/file.md) + relation(../) => path/file.md
|
|
5
|
+
* - path(path/to/file.md) + relation(../now) => path/now/file.md
|
|
6
|
+
*/
|
|
7
|
+
export declare const relateDocOutputPath: (input: {
|
|
8
|
+
path: string;
|
|
9
|
+
relation: string;
|
|
10
|
+
}) => string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.relateDocOutputPath = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
/**
|
|
29
|
+
* .what = computes the relative path, in relation to some relative modifier
|
|
30
|
+
* .how =
|
|
31
|
+
* - path(path/to/file.md) + relation(../) => path/file.md
|
|
32
|
+
* - path(path/to/file.md) + relation(../now) => path/now/file.md
|
|
33
|
+
*/
|
|
34
|
+
const relateDocOutputPath = (input) => {
|
|
35
|
+
const { path: inputPath, relation } = input;
|
|
36
|
+
// split into dir + base
|
|
37
|
+
const dir = path.posix.dirname(inputPath);
|
|
38
|
+
const base = path.posix.basename(inputPath);
|
|
39
|
+
// join dir with relation and normalize
|
|
40
|
+
const newDir = path.posix.normalize(path.posix.join(dir, relation));
|
|
41
|
+
// recombine with base filename
|
|
42
|
+
return path.posix.normalize(path.posix.join(newDir, base));
|
|
43
|
+
};
|
|
44
|
+
exports.relateDocOutputPath = relateDocOutputPath;
|
|
45
|
+
//# sourceMappingURL=relateDocOutputPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relateDocOutputPath.js","sourceRoot":"","sources":["../../../src/logic/hooks/relateDocOutputPath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B;;;;;GAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAGnC,EAAU,EAAE;IACX,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE5C,wBAAwB;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAE5C,uCAAuC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEpE,+BAA+B;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC;AAfW,QAAA,mBAAmB,uBAe9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_fns_1 = require("test-fns");
|
|
4
|
+
const relateDocOutputPath_1 = require("./relateDocOutputPath");
|
|
5
|
+
describe('relateDocOutputPath', () => {
|
|
6
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "../"', () => {
|
|
7
|
+
const input = {
|
|
8
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
9
|
+
relation: '../',
|
|
10
|
+
};
|
|
11
|
+
let result;
|
|
12
|
+
(0, test_fns_1.when)('executed', () => {
|
|
13
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
14
|
+
});
|
|
15
|
+
(0, test_fns_1.then)('it pops one directory: "a/topic.i8.[notes].v1.txt"', () => {
|
|
16
|
+
expect(result).toBe('a/topic.i8.[notes].v1.txt');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "../now"', () => {
|
|
20
|
+
const input = {
|
|
21
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
22
|
+
relation: '../now',
|
|
23
|
+
};
|
|
24
|
+
let result;
|
|
25
|
+
(0, test_fns_1.when)('executed', () => {
|
|
26
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
27
|
+
});
|
|
28
|
+
(0, test_fns_1.then)('it pops one directory and injects "now": "a/now/topic.i8.[notes].v1.txt"', () => {
|
|
29
|
+
expect(result).toBe('a/now/topic.i8.[notes].v1.txt');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "../../"', () => {
|
|
33
|
+
const input = {
|
|
34
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
35
|
+
relation: '../../',
|
|
36
|
+
};
|
|
37
|
+
let result;
|
|
38
|
+
(0, test_fns_1.when)('executed', () => {
|
|
39
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
40
|
+
});
|
|
41
|
+
(0, test_fns_1.then)('it pops two directories to repo root: "topic.i8.[notes].v1.txt"', () => {
|
|
42
|
+
expect(result).toBe('topic.i8.[notes].v1.txt');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "../../now"', () => {
|
|
46
|
+
const input = {
|
|
47
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
48
|
+
relation: '../../now',
|
|
49
|
+
};
|
|
50
|
+
let result;
|
|
51
|
+
(0, test_fns_1.when)('executed', () => {
|
|
52
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
53
|
+
});
|
|
54
|
+
(0, test_fns_1.then)('it goes to root/now: "now/topic.i8.[notes].v1.txt"', () => {
|
|
55
|
+
expect(result).toBe('now/topic.i8.[notes].v1.txt');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "./"', () => {
|
|
59
|
+
const input = {
|
|
60
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
61
|
+
relation: './',
|
|
62
|
+
};
|
|
63
|
+
let result;
|
|
64
|
+
(0, test_fns_1.when)('executed', () => {
|
|
65
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
66
|
+
});
|
|
67
|
+
(0, test_fns_1.then)('it keeps the same directory: "a/b/topic.i8.[notes].v1.txt"', () => {
|
|
68
|
+
expect(result).toBe('a/b/topic.i8.[notes].v1.txt');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "sub/dir"', () => {
|
|
72
|
+
const input = {
|
|
73
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
74
|
+
relation: 'sub/dir',
|
|
75
|
+
};
|
|
76
|
+
let result;
|
|
77
|
+
(0, test_fns_1.when)('executed', () => {
|
|
78
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
79
|
+
});
|
|
80
|
+
(0, test_fns_1.then)('it appends a subdir chain: "a/b/sub/dir/topic.i8.[notes].v1.txt"', () => {
|
|
81
|
+
expect(result).toBe('a/b/sub/dir/topic.i8.[notes].v1.txt');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
(0, test_fns_1.given)('path "topic.i8.[notes].v1.txt" (no directory) and relation "../"', () => {
|
|
85
|
+
const input = {
|
|
86
|
+
path: 'topic.i8.[notes].v1.txt',
|
|
87
|
+
relation: '../',
|
|
88
|
+
};
|
|
89
|
+
let result;
|
|
90
|
+
(0, test_fns_1.when)('executed', () => {
|
|
91
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
92
|
+
});
|
|
93
|
+
(0, test_fns_1.then)('it should show that its relative still', () => {
|
|
94
|
+
expect(result).toBe('../topic.i8.[notes].v1.txt');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
(0, test_fns_1.given)('path "a/b/topic.i8.[notes].v1.txt" and relation "" (empty)', () => {
|
|
98
|
+
const input = {
|
|
99
|
+
path: 'a/b/topic.i8.[notes].v1.txt',
|
|
100
|
+
relation: '',
|
|
101
|
+
};
|
|
102
|
+
let result;
|
|
103
|
+
(0, test_fns_1.when)('executed', () => {
|
|
104
|
+
result = (0, relateDocOutputPath_1.relateDocOutputPath)(input);
|
|
105
|
+
});
|
|
106
|
+
(0, test_fns_1.then)('it returns the original path unchanged', () => {
|
|
107
|
+
expect(result).toBe('a/b/topic.i8.[notes].v1.txt');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=relateDocOutputPath.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relateDocOutputPath.test.js","sourceRoot":"","sources":["../../../src/logic/hooks/relateDocOutputPath.test.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,+DAA4D;AAE5D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAA,gBAAK,EAAC,uDAAuD,EAAE,GAAG,EAAE;QAClE,MAAM,KAAK,GAAG;YACZ,IAAI,EAAE,6BAA6B;YACnC,QAAQ,EAAE,KAAK;SAChB,CAAC;QAEF,IAAI,MAAc,CAAC;QAEnB,IAAA,eAAI,EAAC,UAAU,EAAE,GAAG,EAAE;YACpB,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,IAAA,eAAI,EAAC,oDAAoD,EAAE,GAAG,EAAE;YAC9D,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,gBAAK,EAAC,0DAA0D,EAAE,GAAG,EAAE;QACrE,MAAM,KAAK,GAAG;YACZ,IAAI,EAAE,6BAA6B;YACnC,QAAQ,EAAE,QAAQ;SACnB,CAAC;QAEF,IAAI,MAAc,CAAC;QAEnB,IAAA,eAAI,EAAC,UAAU,EAAE,GAAG,EAAE;YACpB,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,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