@vibe2founder/tests2dialects 0.1.0 → 0.2.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/examples/imperative.spec.d.ts +1 -0
- package/dist/examples/imperative.spec.js +46 -0
- package/dist/examples/math.spec.d.ts +1 -0
- package/dist/examples/math.spec.js +39 -0
- package/dist/examples/narrative.spec.d.ts +1 -0
- package/dist/examples/narrative.spec.js +47 -0
- package/dist/examples/polyglot-shopping-cart.spec.d.ts +11 -0
- package/dist/examples/polyglot-shopping-cart.spec.js +161 -0
- package/dist/examples/sanity.spec.d.ts +1 -0
- package/dist/examples/sanity.spec.js +39 -0
- package/dist/examples/showcase-api.spec.d.ts +1 -0
- package/dist/examples/showcase-api.spec.js +62 -0
- package/dist/examples/test-api.d.ts +1 -0
- package/dist/examples/test-api.js +32 -0
- package/dist/packages/api-test-dialect/index.d.ts +28 -0
- package/dist/packages/api-test-dialect/index.js +102 -0
- package/dist/packages/reqify/index.d.ts +12 -0
- package/dist/packages/reqify/index.js +24 -0
- package/dist/src/cli.d.ts +6 -0
- package/dist/src/cli.js +330 -0
- package/dist/src/index.d.ts +134 -0
- package/dist/src/index.js +374 -0
- package/dist/src/semantic/core.d.ts +24 -0
- package/dist/src/semantic/core.js +16 -0
- package/{types/api-types.ts → dist/types/api-types.d.ts} +6 -11
- package/dist/types/api-types.js +1 -0
- package/package.json +59 -35
- package/packages/api-test-dialect/index.ts +132 -132
- package/readme.md +58 -58
- package/src/cli.ts +1 -1
- package/src/index.ts +19 -16
- package/src/semantic/core.ts +26 -0
- package/CHANGELOG.md +0 -73
- package/bun.lock +0 -22
- package/bunfig.toml +0 -2
- package/critica.md +0 -77
- package/docs/4-ideias.md +0 -66
- package/docs/api-api.md +0 -93
- package/docs/api-imperativo.md +0 -125
- package/docs/api-matematico.md +0 -145
- package/docs/api-narrativo.md +0 -181
- package/docs/guia-rapido.md +0 -189
- package/docs/whitepaper.md +0 -21
- package/examples/imperative.spec.ts +0 -58
- package/examples/math.spec.ts +0 -52
- package/examples/narrative.spec.ts +0 -61
- package/examples/polyglot-shopping-cart.spec.ts +0 -212
- package/examples/sanity.spec.ts +0 -54
- package/examples/showcase-api.spec.ts +0 -70
- package/examples/test-api.ts +0 -36
- package/infograficos/detalhado.png +0 -0
- package/infograficos/mobile.png +0 -0
- package/infograficos/normal.png +0 -0
- package/landing-page/README.md +0 -38
- package/landing-page/bun.lock +0 -609
- package/landing-page/eslint.config.js +0 -23
- package/landing-page/index.html +0 -17
- package/landing-page/package-lock.json +0 -2962
- package/landing-page/package.json +0 -34
- package/landing-page/postcss.config.js +0 -6
- package/landing-page/public/vite.svg +0 -1
- package/landing-page/src/App.tsx +0 -358
- package/landing-page/src/assets/react.svg +0 -1
- package/landing-page/src/index.css +0 -34
- package/landing-page/src/main.tsx +0 -10
- package/landing-page/tailwind.config.js +0 -59
- package/landing-page/tsconfig.app.json +0 -28
- package/landing-page/tsconfig.json +0 -7
- package/landing-page/tsconfig.node.json +0 -26
- package/landing-page/vite.config.ts +0 -7
- package/logo.png +0 -0
- package/output.log +0 -60
- package/podcast/O_Matem/303/241tico,_o_Narrador_e_o_Engenheiro.json +0 -0
- package/podcast/O_Matem/303/241tico,_o_Narrador_e_o_Engenheiro.md +0 -0
- package/podcast/critica-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.json +0 -0
- package/podcast/critica-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.md +0 -0
- package/podcast/critica-Unificar_filosofia_e_pr/303/241tica_na_documenta/303/247/303/243o_(7_words__covers_t.md +0 -1
- package/podcast/critica-Unificar_filosofia_e_pr/303/241tica_na_documenta/303/247/303/243o__7_words__covers_t.ogg +0 -0
- package/podcast/critica2-Sil/303/252ncio_estrat/303/251gico_e_sobrecarga_em_READMEs.ogg +0 -0
- package/podcast/critica2.json +0 -3191
- package/podcast/critica2.md +0 -1
- package/podcast/debate-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.json +0 -0
- package/podcast/debate-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.md +0 -0
- package/reports/01-01-2026_00-45.md +0 -40
- package/reports/01-01-2026_02-30.md +0 -37
- package/reports/03-02-2026_10-55.md +0 -8
- package/reports/03-02-2026_11-45.md +0 -13
- package/reports/03-02-2026_11-50.md +0 -10
- package/reports/26-01-2026_16-25.md +0 -31
- package/reports/26-01-2026_19-20.md +0 -27
- package/reports/31-12-2025_22-35.md +0 -25
- package/reports/31-12-2025_22-45.md +0 -15
- package/slides/Dialetos_de_Teste_Um_Executor_M/303/272ltiplos_Vocabul/303/241rios.pdf +0 -0
- package/tabela.html +0 -350
- package/tsconfig.json +0 -22
- package/www/index.html +0 -1344
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
class AtomicCore {
|
|
2
|
+
static instance;
|
|
3
|
+
rootSuite = {
|
|
4
|
+
name: "ROOT",
|
|
5
|
+
tests: [],
|
|
6
|
+
hooks: { beforeAll: [], afterAll: [], beforeEach: [], afterEach: [] },
|
|
7
|
+
};
|
|
8
|
+
currentSuite = this.rootSuite;
|
|
9
|
+
suiteStarted = new Set();
|
|
10
|
+
static get() {
|
|
11
|
+
if (!AtomicCore.instance)
|
|
12
|
+
AtomicCore.instance = new AtomicCore();
|
|
13
|
+
return AtomicCore.instance;
|
|
14
|
+
}
|
|
15
|
+
// --- Atomic Actions ---
|
|
16
|
+
defineGroup(name, fn) {
|
|
17
|
+
const parent = this.currentSuite;
|
|
18
|
+
const newSuite = {
|
|
19
|
+
name: name,
|
|
20
|
+
tests: [],
|
|
21
|
+
hooks: { beforeAll: [], afterAll: [], beforeEach: [], afterEach: [] },
|
|
22
|
+
parent,
|
|
23
|
+
};
|
|
24
|
+
this.currentSuite = newSuite;
|
|
25
|
+
try {
|
|
26
|
+
fn();
|
|
27
|
+
newSuite.hooks.afterAll.forEach((h) => h());
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
this.currentSuite = parent;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
defineCase(name, fn) {
|
|
34
|
+
this.runTestSafe(this.currentSuite, name, fn);
|
|
35
|
+
}
|
|
36
|
+
addHook(type, fn) {
|
|
37
|
+
this.currentSuite.hooks[type].push(fn);
|
|
38
|
+
}
|
|
39
|
+
// --- Internal Runner Logic ---
|
|
40
|
+
async runTestSafe(suite, name, fn) {
|
|
41
|
+
// Run beforeAll if first test in this suite
|
|
42
|
+
if (!this.suiteStarted.has(suite)) {
|
|
43
|
+
suite.hooks.beforeAll.forEach((h) => h());
|
|
44
|
+
this.suiteStarted.add(suite);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
// Run BeforeEach hooks
|
|
48
|
+
suite.hooks.beforeEach.forEach((h) => h());
|
|
49
|
+
await fn();
|
|
50
|
+
// Run AfterEach hooks
|
|
51
|
+
suite.hooks.afterEach.forEach((h) => h());
|
|
52
|
+
}
|
|
53
|
+
catch (_e) {
|
|
54
|
+
// Handle failure silently in core, or emit event for reporter
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
reset() {
|
|
58
|
+
this.rootSuite = {
|
|
59
|
+
name: "ROOT",
|
|
60
|
+
tests: [],
|
|
61
|
+
hooks: { beforeAll: [], afterAll: [], beforeEach: [], afterEach: [] },
|
|
62
|
+
};
|
|
63
|
+
this.currentSuite = this.rootSuite;
|
|
64
|
+
this.suiteStarted.clear();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const core = AtomicCore.get();
|
|
68
|
+
export const resetAtomicCore = () => core.reset();
|
|
69
|
+
// ... (UniversalMockHandler, UniversalAssertion, Dialects logic remains, just update signatures if needed)
|
|
70
|
+
// Using ... to represent that the rest of the file stays largely the same but with potential type updates
|
|
71
|
+
// Actually I need to provide the full content or important chunks. I'll replace the whole file to be safe with types.
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// 2. UNIVERSAL MOCK (O Ator/Dublê)
|
|
74
|
+
// ============================================================================
|
|
75
|
+
class UniversalMockHandler {
|
|
76
|
+
calls = [];
|
|
77
|
+
impl = null;
|
|
78
|
+
defaultReturn = undefined;
|
|
79
|
+
isResolved = false;
|
|
80
|
+
parent = null;
|
|
81
|
+
constructor(originalImpl) {
|
|
82
|
+
this.impl = originalImpl || null;
|
|
83
|
+
}
|
|
84
|
+
setParent(parent) {
|
|
85
|
+
this.parent = parent;
|
|
86
|
+
}
|
|
87
|
+
// O método que é chamado quando alguém invoca o mock
|
|
88
|
+
invoke(...args) {
|
|
89
|
+
this.calls.push(args);
|
|
90
|
+
// Notifica o pai que houve uma interação (útil para to(obj).wasCalled())
|
|
91
|
+
if (this.parent)
|
|
92
|
+
this.parent.invoke(...args);
|
|
93
|
+
if (this.impl)
|
|
94
|
+
return this.impl(...args);
|
|
95
|
+
if (this.isResolved)
|
|
96
|
+
return Promise.resolve(this.defaultReturn);
|
|
97
|
+
return this.defaultReturn;
|
|
98
|
+
}
|
|
99
|
+
// --- Setup Methods (Aliases Internos) ---
|
|
100
|
+
setReturn(val) {
|
|
101
|
+
this.defaultReturn = val;
|
|
102
|
+
this.isResolved = false;
|
|
103
|
+
}
|
|
104
|
+
setResolved(val) {
|
|
105
|
+
this.defaultReturn = val;
|
|
106
|
+
this.isResolved = true;
|
|
107
|
+
}
|
|
108
|
+
setImplementation(fn) {
|
|
109
|
+
this.impl = fn;
|
|
110
|
+
}
|
|
111
|
+
clear() {
|
|
112
|
+
this.calls = [];
|
|
113
|
+
}
|
|
114
|
+
getDefaultReturn() {
|
|
115
|
+
return this.defaultReturn;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// A função mágica que é ao mesmo tempo executável e configurável
|
|
119
|
+
function createAtomicMock(implementation, parentHandler) {
|
|
120
|
+
const handler = new UniversalMockHandler(implementation);
|
|
121
|
+
if (parentHandler)
|
|
122
|
+
handler.setParent(parentHandler);
|
|
123
|
+
const subMocks = new Map();
|
|
124
|
+
const mockFn = (...args) => handler.invoke(...args);
|
|
125
|
+
// Mapeamento de TODOS os métodos de configuração de mocks
|
|
126
|
+
const config = {
|
|
127
|
+
_handler: handler,
|
|
128
|
+
// Jest
|
|
129
|
+
mockReturnValue: (v) => handler.setReturn(v),
|
|
130
|
+
mockResolvedValue: (v) => handler.setResolved(v),
|
|
131
|
+
mockImplementation: (fn) => handler.setImplementation(fn),
|
|
132
|
+
// Matemático
|
|
133
|
+
yields: (v) => handler.setReturn(v),
|
|
134
|
+
mapsTo: (v) => handler.setReturn(v),
|
|
135
|
+
convergesTo: (v) => handler.setResolved(v),
|
|
136
|
+
derive: (fn) => handler.setImplementation(fn),
|
|
137
|
+
// Narrativo
|
|
138
|
+
respondsWith: (v) => handler.setReturn(v),
|
|
139
|
+
eventuallyGives: (v) => handler.setResolved(v),
|
|
140
|
+
actsLike: (fn) => handler.setImplementation(fn),
|
|
141
|
+
// Imperativo
|
|
142
|
+
forceReturn: (v) => handler.setReturn(v),
|
|
143
|
+
resolveWith: (v) => handler.setResolved(v),
|
|
144
|
+
executes: (fn) => handler.setImplementation(fn),
|
|
145
|
+
// Common
|
|
146
|
+
clear: () => {
|
|
147
|
+
handler.clear();
|
|
148
|
+
subMocks.forEach((m) => m.clear());
|
|
149
|
+
},
|
|
150
|
+
reset: () => {
|
|
151
|
+
handler.clear();
|
|
152
|
+
handler.setImplementation(null);
|
|
153
|
+
handler.setReturn(undefined);
|
|
154
|
+
subMocks.clear();
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
// Retornamos um Proxy para permitir acesso a propriedades arbitrárias (como métodos)
|
|
158
|
+
return new Proxy(mockFn, {
|
|
159
|
+
get(target, prop) {
|
|
160
|
+
// 1. Se for um método de configuração ou propriedade interna, retorna do config
|
|
161
|
+
if (prop in config)
|
|
162
|
+
return config[prop];
|
|
163
|
+
if (prop === "then")
|
|
164
|
+
return undefined; // Evita problemas com Promises
|
|
165
|
+
// 2. Se o mock foi configurado para retornar um objeto, tentamos pegar a propriedade dele
|
|
166
|
+
const currentReturn = handler.getDefaultReturn();
|
|
167
|
+
if (currentReturn &&
|
|
168
|
+
typeof currentReturn === "object" &&
|
|
169
|
+
prop in currentReturn) {
|
|
170
|
+
return currentReturn[prop];
|
|
171
|
+
}
|
|
172
|
+
// 3. Se for uma propriedade arbitrária e não temos valor, retornamos um sub-mock (lazy creation)
|
|
173
|
+
if (!subMocks.has(prop)) {
|
|
174
|
+
subMocks.set(prop, createAtomicMock(undefined, handler));
|
|
175
|
+
}
|
|
176
|
+
return subMocks.get(prop);
|
|
177
|
+
},
|
|
178
|
+
// Permite Object.assign e outras operações
|
|
179
|
+
set(target, prop, value) {
|
|
180
|
+
config[prop] = value;
|
|
181
|
+
return true;
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function createAtomicSpy(obj, method) {
|
|
186
|
+
const original = obj[method];
|
|
187
|
+
const mock = createAtomicMock(original);
|
|
188
|
+
obj[method] = mock;
|
|
189
|
+
return mock; // Retorna o mock para asserções
|
|
190
|
+
}
|
|
191
|
+
// ============================================================================
|
|
192
|
+
// 3. UNIVERSAL ASSERTION (O Juiz)
|
|
193
|
+
// ============================================================================
|
|
194
|
+
class UniversalAssertion {
|
|
195
|
+
actual;
|
|
196
|
+
isNegated;
|
|
197
|
+
constructor(actual, isNegated = false) {
|
|
198
|
+
this.actual = actual;
|
|
199
|
+
this.isNegated = isNegated;
|
|
200
|
+
}
|
|
201
|
+
get not() {
|
|
202
|
+
return new UniversalAssertion(this.actual, !this.isNegated);
|
|
203
|
+
}
|
|
204
|
+
pass(condition, msg) {
|
|
205
|
+
const success = this.isNegated ? !condition : condition;
|
|
206
|
+
if (!success)
|
|
207
|
+
throw new Error(this.isNegated ? `[NOT] ${msg}` : msg);
|
|
208
|
+
}
|
|
209
|
+
// --- Equality & Truthiness ---
|
|
210
|
+
// Jest / Classic
|
|
211
|
+
toBe(expected) {
|
|
212
|
+
this.pass(this.actual === expected, `Expected ${this.actual} to be ${expected}`);
|
|
213
|
+
}
|
|
214
|
+
toEqual(expected) {
|
|
215
|
+
this.pass(JSON.stringify(this.actual) === JSON.stringify(expected), `Expected ${this.actual} to equal ${expected}`);
|
|
216
|
+
}
|
|
217
|
+
// Matemático
|
|
218
|
+
is(expected) {
|
|
219
|
+
this.toBe(expected);
|
|
220
|
+
}
|
|
221
|
+
// Narrativo
|
|
222
|
+
be(expected) {
|
|
223
|
+
this.toBe(expected);
|
|
224
|
+
}
|
|
225
|
+
// Imperativo
|
|
226
|
+
isOk() {
|
|
227
|
+
this.pass(!!this.actual, `Ensure ${this.actual} is truthy`);
|
|
228
|
+
}
|
|
229
|
+
matches(regex) {
|
|
230
|
+
if (typeof this.actual !== "string")
|
|
231
|
+
throw new Error("Value must be string");
|
|
232
|
+
this.pass(regex.test(this.actual), `Ensure '${this.actual}' matches ${regex}`);
|
|
233
|
+
}
|
|
234
|
+
// Narrativo
|
|
235
|
+
have(prop) {
|
|
236
|
+
this.pass(typeof this.actual === "object" &&
|
|
237
|
+
this.actual !== null &&
|
|
238
|
+
prop in this.actual, `Intend object to have '${prop}'`);
|
|
239
|
+
}
|
|
240
|
+
uploaded(...args) {
|
|
241
|
+
this.received(...args);
|
|
242
|
+
}
|
|
243
|
+
// --- Mock Assertions ---
|
|
244
|
+
// Helper para pegar o handler do mock
|
|
245
|
+
getMockHandler(mockFn) {
|
|
246
|
+
if (!mockFn._handler)
|
|
247
|
+
throw new Error("Assertion target is not a registered Mock/Spy function.");
|
|
248
|
+
return mockFn._handler;
|
|
249
|
+
}
|
|
250
|
+
// Jest
|
|
251
|
+
toHaveBeenCalled() {
|
|
252
|
+
const h = this.getMockHandler(this.actual);
|
|
253
|
+
this.pass(h.calls.length > 0, "Expected mock to have been called");
|
|
254
|
+
}
|
|
255
|
+
toHaveBeenCalledWith(...args) {
|
|
256
|
+
const h = this.getMockHandler(this.actual);
|
|
257
|
+
const match = h.calls.some((call) => JSON.stringify(call) === JSON.stringify(args));
|
|
258
|
+
this.pass(match, `Expected mock called with ${JSON.stringify(args)}`);
|
|
259
|
+
}
|
|
260
|
+
toHaveBeenCalledTimes(n) {
|
|
261
|
+
const h = this.getMockHandler(this.actual);
|
|
262
|
+
this.pass(h.calls.length === n, `Expected mock called ${n} times, got ${h.calls.length}`);
|
|
263
|
+
}
|
|
264
|
+
// Matemático
|
|
265
|
+
wasEvaluated() {
|
|
266
|
+
this.toHaveBeenCalled();
|
|
267
|
+
}
|
|
268
|
+
appliedTo(...args) {
|
|
269
|
+
this.toHaveBeenCalledWith(...args);
|
|
270
|
+
}
|
|
271
|
+
get evaluated() {
|
|
272
|
+
const h = this.getMockHandler(this.actual);
|
|
273
|
+
return (n) => ({ times: this.toHaveBeenCalledTimes(n) }); // Currying simulado para sintaxe .evaluated(n).times
|
|
274
|
+
}
|
|
275
|
+
// Narrativo
|
|
276
|
+
wasCalled() {
|
|
277
|
+
this.toHaveBeenCalled();
|
|
278
|
+
}
|
|
279
|
+
received(...args) {
|
|
280
|
+
this.toHaveBeenCalledWith(...args);
|
|
281
|
+
}
|
|
282
|
+
get called() {
|
|
283
|
+
const h = this.getMockHandler(this.actual);
|
|
284
|
+
return (n) => ({ times: this.toHaveBeenCalledTimes(n) });
|
|
285
|
+
}
|
|
286
|
+
// Imperativo
|
|
287
|
+
triggered() {
|
|
288
|
+
this.toHaveBeenCalled();
|
|
289
|
+
}
|
|
290
|
+
calledWith(...args) {
|
|
291
|
+
this.toHaveBeenCalledWith(...args);
|
|
292
|
+
}
|
|
293
|
+
triggeredCount(n) {
|
|
294
|
+
this.toHaveBeenCalledTimes(n);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Factory para assertions
|
|
298
|
+
const assertValue = (val) => new UniversalAssertion(val);
|
|
299
|
+
// ============================================================================
|
|
300
|
+
// 4. DIALECT EXPORTS (A Pedra de Roseta)
|
|
301
|
+
// ============================================================================
|
|
302
|
+
// --- 📐 MATEMÁTICO (MathDialect) ---
|
|
303
|
+
export const MathDialect = {
|
|
304
|
+
// Structure
|
|
305
|
+
axiom: (n, f) => core.defineGroup(n, f),
|
|
306
|
+
proof: (n, f) => core.defineCase(n, f),
|
|
307
|
+
implies: assertValue,
|
|
308
|
+
// Mocks (Creation)
|
|
309
|
+
arbitrary: createAtomicMock,
|
|
310
|
+
lambda: createAtomicMock,
|
|
311
|
+
monitor: createAtomicSpy,
|
|
312
|
+
// Lifecycle
|
|
313
|
+
postulate: (f) => core.addHook("beforeAll", f),
|
|
314
|
+
conclude: (f) => core.addHook("afterAll", f),
|
|
315
|
+
given: (f) => core.addHook("beforeEach", f),
|
|
316
|
+
};
|
|
317
|
+
// --- 📖 NARRATIVO (NarrativeDialect) ---
|
|
318
|
+
export const NarrativeDialect = {
|
|
319
|
+
// Structure
|
|
320
|
+
intend: (n, f) => core.defineGroup(n, f),
|
|
321
|
+
story: (n, f) => core.defineGroup(n, f),
|
|
322
|
+
detail: (n, f) => core.defineCase(n, f),
|
|
323
|
+
scenario: (n, f) => core.defineCase(n, f),
|
|
324
|
+
to: assertValue,
|
|
325
|
+
// Mocks (Creation)
|
|
326
|
+
dummy: createAtomicMock,
|
|
327
|
+
standIn: createAtomicMock,
|
|
328
|
+
watch: createAtomicSpy,
|
|
329
|
+
shadow: createAtomicSpy,
|
|
330
|
+
// Lifecycle
|
|
331
|
+
background: (f) => core.addHook("beforeAll", f),
|
|
332
|
+
cleanup: (f) => core.addHook("afterAll", f),
|
|
333
|
+
before: (f) => core.addHook("beforeEach", f),
|
|
334
|
+
};
|
|
335
|
+
// --- 🛡️ IMPERATIVO (ImperativeDialect) ---
|
|
336
|
+
export const ImperativeDialect = {
|
|
337
|
+
// Structure
|
|
338
|
+
ensure: (n, f) => core.defineGroup(n, f),
|
|
339
|
+
suite: (n, f) => core.defineGroup(n, f),
|
|
340
|
+
check: (n, f) => core.defineCase(n, f),
|
|
341
|
+
verify: (n, f) => core.defineCase(n, f),
|
|
342
|
+
that: assertValue,
|
|
343
|
+
// Mocks (Creation)
|
|
344
|
+
stub: createAtomicMock,
|
|
345
|
+
mock: createAtomicMock,
|
|
346
|
+
inspect: createAtomicSpy,
|
|
347
|
+
spy: createAtomicSpy,
|
|
348
|
+
// Lifecycle
|
|
349
|
+
initAll: (f) => core.addHook("beforeAll", f),
|
|
350
|
+
disposeAll: (f) => core.addHook("afterAll", f),
|
|
351
|
+
reset: (f) => core.addHook("beforeEach", f),
|
|
352
|
+
clear: () => { }, // No-op for global clear
|
|
353
|
+
};
|
|
354
|
+
// --- 🤡 JEST / CLASSIC ---
|
|
355
|
+
export const ClassicDialect = {
|
|
356
|
+
describe: (n, f) => core.defineGroup(n, f),
|
|
357
|
+
it: (n, f) => core.defineCase(n, f),
|
|
358
|
+
test: (n, f) => core.defineCase(n, f),
|
|
359
|
+
expect: assertValue,
|
|
360
|
+
// Objeto Jest Global (simulado)
|
|
361
|
+
jest: {
|
|
362
|
+
fn: createAtomicMock,
|
|
363
|
+
spyOn: createAtomicSpy,
|
|
364
|
+
},
|
|
365
|
+
beforeAll: (f) => core.addHook("beforeAll", f),
|
|
366
|
+
afterAll: (f) => core.addHook("afterAll", f),
|
|
367
|
+
beforeEach: (f) => core.addHook("beforeEach", f),
|
|
368
|
+
afterEach: (f) => core.addHook("afterEach", f),
|
|
369
|
+
};
|
|
370
|
+
// --- Top-Level Exports for Ease of Use ---
|
|
371
|
+
export const { axiom, proof, implies, arbitrary, lambda, monitor, postulate, conclude, given, } = MathDialect;
|
|
372
|
+
export const { intend, story, detail, scenario, to, dummy, standIn, watch, shadow, background, cleanup, before, } = NarrativeDialect;
|
|
373
|
+
export const { ensure, suite, check, verify, that, stub, mock, inspect, spy, initAll, disposeAll, reset, clear, } = ImperativeDialect;
|
|
374
|
+
export const { describe, it, test, expect, beforeAll, afterAll, beforeEach, afterEach, } = ClassicDialect;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const __brand: unique symbol;
|
|
2
|
+
export type Brand<T, B extends string> = T & {
|
|
3
|
+
readonly [__brand]: B;
|
|
4
|
+
};
|
|
5
|
+
export type Bool<Name extends string> = Brand<boolean, `bool:${Name}`>;
|
|
6
|
+
export type Num<Name extends string> = Brand<number, `num:${Name}`>;
|
|
7
|
+
export type Str<Name extends string> = Brand<string, `str:${Name}`>;
|
|
8
|
+
export declare const STAMP: <B extends string>() => {
|
|
9
|
+
of: <T>(v: T) => Brand<T, B>;
|
|
10
|
+
un: <T>(v: Brand<T, B>) => T;
|
|
11
|
+
};
|
|
12
|
+
export declare const makeBool: <N extends string>(_name: N) => {
|
|
13
|
+
of: (v: boolean) => Bool<N>;
|
|
14
|
+
un: (v: Bool<N>) => boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const makeNum: <N extends string>(_name: N) => {
|
|
17
|
+
of: (v: number) => Num<N>;
|
|
18
|
+
un: (v: Num<N>) => number;
|
|
19
|
+
};
|
|
20
|
+
export declare const makeStr: <N extends string>(_name: N) => {
|
|
21
|
+
of: (v: string) => Str<N>;
|
|
22
|
+
un: (v: Str<N>) => string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const STAMP = () => ({
|
|
2
|
+
of: (v) => v,
|
|
3
|
+
un: (v) => v,
|
|
4
|
+
});
|
|
5
|
+
export const makeBool = (_name) => ({
|
|
6
|
+
of: (v) => v,
|
|
7
|
+
un: (v) => v,
|
|
8
|
+
});
|
|
9
|
+
export const makeNum = (_name) => ({
|
|
10
|
+
of: (v) => v,
|
|
11
|
+
un: (v) => v,
|
|
12
|
+
});
|
|
13
|
+
export const makeStr = (_name) => ({
|
|
14
|
+
of: (v) => v,
|
|
15
|
+
un: (v) => v,
|
|
16
|
+
});
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
export type JsonBody = Record<string, unknown> | unknown[];
|
|
8
|
-
|
|
9
|
-
export type TestName = string;
|
|
10
|
-
|
|
11
|
-
export type SchemaDefinition = Record<string, unknown>;
|
|
1
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
2
|
+
export type HttpStatusCode = number;
|
|
3
|
+
export type ApiUrl = string;
|
|
4
|
+
export type JsonBody = Record<string, unknown> | unknown[];
|
|
5
|
+
export type TestName = string;
|
|
6
|
+
export type SchemaDefinition = Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,36 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vibe2founder/tests2dialects",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibe2founder/tests2dialects",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"module": "./dist/src/index.js",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"public": true,
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/src/index.d.ts",
|
|
12
|
+
"import": "./dist/src/index.js",
|
|
13
|
+
"default": "./dist/src/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"access": "public",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"start": "node dist/src/index.js",
|
|
20
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"tests",
|
|
24
|
+
"testing",
|
|
25
|
+
"tdd",
|
|
26
|
+
"bdd",
|
|
27
|
+
"test-runner",
|
|
28
|
+
"dialects",
|
|
29
|
+
"vitest",
|
|
30
|
+
"jest",
|
|
31
|
+
"bun-test"
|
|
32
|
+
],
|
|
33
|
+
"author": "vibe2founder",
|
|
34
|
+
"license": "Cogfulness Ethical License (CEL) v1.0",
|
|
35
|
+
"description": "Framework unificado de testes TDD/BDD com múltiplos dialetos",
|
|
36
|
+
"bin": {
|
|
37
|
+
"tests2dialects": "./src/cli.ts",
|
|
38
|
+
"os4all": "./src/cli.ts",
|
|
39
|
+
"1spec": "./src/cli.ts",
|
|
40
|
+
"testall": "./src/cli.ts"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"typescript": "latest",
|
|
48
|
+
"undici-types": "latest",
|
|
49
|
+
"@types/node": "latest"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/vibe2founder/tests2dialects.git"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist",
|
|
57
|
+
"src",
|
|
58
|
+
"packages"
|
|
59
|
+
]
|
|
36
60
|
}
|