@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.
Files changed (96) hide show
  1. package/dist/examples/imperative.spec.d.ts +1 -0
  2. package/dist/examples/imperative.spec.js +46 -0
  3. package/dist/examples/math.spec.d.ts +1 -0
  4. package/dist/examples/math.spec.js +39 -0
  5. package/dist/examples/narrative.spec.d.ts +1 -0
  6. package/dist/examples/narrative.spec.js +47 -0
  7. package/dist/examples/polyglot-shopping-cart.spec.d.ts +11 -0
  8. package/dist/examples/polyglot-shopping-cart.spec.js +161 -0
  9. package/dist/examples/sanity.spec.d.ts +1 -0
  10. package/dist/examples/sanity.spec.js +39 -0
  11. package/dist/examples/showcase-api.spec.d.ts +1 -0
  12. package/dist/examples/showcase-api.spec.js +62 -0
  13. package/dist/examples/test-api.d.ts +1 -0
  14. package/dist/examples/test-api.js +32 -0
  15. package/dist/packages/api-test-dialect/index.d.ts +28 -0
  16. package/dist/packages/api-test-dialect/index.js +102 -0
  17. package/dist/packages/reqify/index.d.ts +12 -0
  18. package/dist/packages/reqify/index.js +24 -0
  19. package/dist/src/cli.d.ts +6 -0
  20. package/dist/src/cli.js +330 -0
  21. package/dist/src/index.d.ts +134 -0
  22. package/dist/src/index.js +374 -0
  23. package/dist/src/semantic/core.d.ts +24 -0
  24. package/dist/src/semantic/core.js +16 -0
  25. package/{types/api-types.ts → dist/types/api-types.d.ts} +6 -11
  26. package/dist/types/api-types.js +1 -0
  27. package/package.json +59 -35
  28. package/packages/api-test-dialect/index.ts +132 -132
  29. package/readme.md +58 -58
  30. package/src/cli.ts +1 -1
  31. package/src/index.ts +19 -16
  32. package/src/semantic/core.ts +26 -0
  33. package/CHANGELOG.md +0 -73
  34. package/bun.lock +0 -22
  35. package/bunfig.toml +0 -2
  36. package/critica.md +0 -77
  37. package/docs/4-ideias.md +0 -66
  38. package/docs/api-api.md +0 -93
  39. package/docs/api-imperativo.md +0 -125
  40. package/docs/api-matematico.md +0 -145
  41. package/docs/api-narrativo.md +0 -181
  42. package/docs/guia-rapido.md +0 -189
  43. package/docs/whitepaper.md +0 -21
  44. package/examples/imperative.spec.ts +0 -58
  45. package/examples/math.spec.ts +0 -52
  46. package/examples/narrative.spec.ts +0 -61
  47. package/examples/polyglot-shopping-cart.spec.ts +0 -212
  48. package/examples/sanity.spec.ts +0 -54
  49. package/examples/showcase-api.spec.ts +0 -70
  50. package/examples/test-api.ts +0 -36
  51. package/infograficos/detalhado.png +0 -0
  52. package/infograficos/mobile.png +0 -0
  53. package/infograficos/normal.png +0 -0
  54. package/landing-page/README.md +0 -38
  55. package/landing-page/bun.lock +0 -609
  56. package/landing-page/eslint.config.js +0 -23
  57. package/landing-page/index.html +0 -17
  58. package/landing-page/package-lock.json +0 -2962
  59. package/landing-page/package.json +0 -34
  60. package/landing-page/postcss.config.js +0 -6
  61. package/landing-page/public/vite.svg +0 -1
  62. package/landing-page/src/App.tsx +0 -358
  63. package/landing-page/src/assets/react.svg +0 -1
  64. package/landing-page/src/index.css +0 -34
  65. package/landing-page/src/main.tsx +0 -10
  66. package/landing-page/tailwind.config.js +0 -59
  67. package/landing-page/tsconfig.app.json +0 -28
  68. package/landing-page/tsconfig.json +0 -7
  69. package/landing-page/tsconfig.node.json +0 -26
  70. package/landing-page/vite.config.ts +0 -7
  71. package/logo.png +0 -0
  72. package/output.log +0 -60
  73. package/podcast/O_Matem/303/241tico,_o_Narrador_e_o_Engenheiro.json +0 -0
  74. package/podcast/O_Matem/303/241tico,_o_Narrador_e_o_Engenheiro.md +0 -0
  75. package/podcast/critica-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.json +0 -0
  76. package/podcast/critica-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.md +0 -0
  77. package/podcast/critica-Unificar_filosofia_e_pr/303/241tica_na_documenta/303/247/303/243o_(7_words__covers_t.md +0 -1
  78. package/podcast/critica-Unificar_filosofia_e_pr/303/241tica_na_documenta/303/247/303/243o__7_words__covers_t.ogg +0 -0
  79. package/podcast/critica2-Sil/303/252ncio_estrat/303/251gico_e_sobrecarga_em_READMEs.ogg +0 -0
  80. package/podcast/critica2.json +0 -3191
  81. package/podcast/critica2.md +0 -1
  82. package/podcast/debate-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.json +0 -0
  83. package/podcast/debate-Dialetos_de_teste__inova/303/247/303/243o_ou_fragmenta/303/247/303/243o_.md +0 -0
  84. package/reports/01-01-2026_00-45.md +0 -40
  85. package/reports/01-01-2026_02-30.md +0 -37
  86. package/reports/03-02-2026_10-55.md +0 -8
  87. package/reports/03-02-2026_11-45.md +0 -13
  88. package/reports/03-02-2026_11-50.md +0 -10
  89. package/reports/26-01-2026_16-25.md +0 -31
  90. package/reports/26-01-2026_19-20.md +0 -27
  91. package/reports/31-12-2025_22-35.md +0 -25
  92. package/reports/31-12-2025_22-45.md +0 -15
  93. package/slides/Dialetos_de_Teste_Um_Executor_M/303/272ltiplos_Vocabul/303/241rios.pdf +0 -0
  94. package/tabela.html +0 -350
  95. package/tsconfig.json +0 -22
  96. package/www/index.html +0 -1344
@@ -1,212 +0,0 @@
1
- /**
2
- * 🛒 Shopping Cart - Exemplo Poliglota
3
- *
4
- * Este arquivo demonstra como usar os 3 dialetos de forma semântica e coerente
5
- * para testar diferentes camadas de uma mesma funcionalidade: um carrinho de compras.
6
- *
7
- * - 📐 Matemático: Testa a lógica PURA de cálculo (descontos, totais)
8
- * - 📖 Narrativo: Testa a JORNADA do usuário (adicionar, remover, finalizar)
9
- * - 🛡️ Imperativo: Testa a INTEGRAÇÃO com API (gateway de pagamento)
10
- */
11
-
12
- import {
13
- // 📐 Matemático - para lógica pura
14
- axiom,
15
- proof,
16
- implies,
17
- arbitrary,
18
- given,
19
- // 📖 Narrativo - para jornada do usuário
20
- intend,
21
- scenario,
22
- to,
23
- standIn,
24
- background,
25
- // 🛡️ Imperativo - para integração de sistema
26
- ensure,
27
- check,
28
- that,
29
- stub,
30
- initAll,
31
- reset,
32
- clear,
33
- } from "../src/index.js";
34
-
35
- // =============================================================================
36
- // 📐 CAMADA MATEMÁTICA: Lógica Pura de Preços
37
- // =============================================================================
38
- // Aqui provamos verdades universais sobre cálculos financeiros.
39
- // Não há dependências externas, não há estado. Apenas matemática.
40
-
41
- axiom("Teoria de Cálculo de Preços", () => {
42
- let calcDiscount: (price: number, percent: number) => number;
43
- let calcTotal: (items: { price: number; qty: number }[]) => number;
44
- let applyTax: (subtotal: number, rate: number) => number;
45
-
46
- given(() => {
47
- // Funções puras - determinísticas, sem side effects
48
- calcDiscount = (price, percent) => price - price * (percent / 100);
49
- calcTotal = (items) => items.reduce((sum, i) => sum + i.price * i.qty, 0);
50
- applyTax = (subtotal, rate) =>
51
- Math.round(subtotal * (1 + rate) * 100) / 100;
52
- });
53
-
54
- proof("Desconto de 10% em R$100 implica R$90", () => {
55
- implies(calcDiscount(100, 10)).is(90);
56
- });
57
-
58
- proof("Desconto de 0% preserva o valor original", () => {
59
- implies(calcDiscount(250, 0)).is(250);
60
- });
61
-
62
- proof("Desconto de 100% anula o preço", () => {
63
- implies(calcDiscount(500, 100)).is(0);
64
- });
65
-
66
- proof("Total de carrinho vazio converge para zero", () => {
67
- implies(calcTotal([])).is(0);
68
- });
69
-
70
- proof("Total de 3 itens a R$10 cada (qty=2) implica R$60", () => {
71
- const items = [
72
- { price: 10, qty: 2 },
73
- { price: 10, qty: 2 },
74
- { price: 10, qty: 2 },
75
- ];
76
- implies(calcTotal(items)).is(60);
77
- });
78
-
79
- proof("Imposto de 10% sobre R$100 resulta em R$110", () => {
80
- implies(applyTax(100, 0.1)).is(110);
81
- });
82
- });
83
-
84
- // =============================================================================
85
- // 📖 CAMADA NARRATIVA: Jornada do Usuário
86
- // =============================================================================
87
- // Aqui contamos histórias que o PM pode ler e entender.
88
- // Descrevemos a experiência do usuário em linguagem natural.
89
-
90
- intend("Jornada de Compra do Usuário", () => {
91
- const cart = standIn(); // Dublê do serviço de carrinho
92
- const user = standIn(); // Dublê do usuário
93
-
94
- background(() => {
95
- // Preparação do cenário
96
- cart.respondsWith({ items: [], total: 0 });
97
- user.respondsWith({ name: "João", loggedIn: true });
98
- });
99
-
100
- scenario("Usuário adiciona primeiro produto ao carrinho", () => {
101
- cart.add({ name: "Camiseta", price: 49.9 });
102
- cart.respondsWith({
103
- items: [{ name: "Camiseta", price: 49.9 }],
104
- total: 49.9,
105
- });
106
-
107
- to(cart).wasCalled();
108
- to(cart.items).have("length");
109
- });
110
-
111
- scenario("Usuário aplica cupom de desconto", () => {
112
- const coupon = standIn();
113
- coupon.respondsWith({ valid: true, discount: 15 });
114
-
115
- // Link the mock logic for the purpose of this example
116
- cart.applyCoupon.actsLike(() => coupon("DESCONTO15"));
117
-
118
- cart.applyCoupon("DESCONTO15");
119
- cart.respondsWith({ total: 42.42 }); // 49.9 - 15%
120
-
121
- to(coupon).wasCalled();
122
- to(cart.total).be(42.42);
123
- });
124
-
125
- scenario("Usuário remove item e carrinho fica vazio", () => {
126
- cart.remove("Camiseta");
127
- cart.respondsWith({ items: [], total: 0 });
128
-
129
- to(cart.items).have("length");
130
- to(cart.total).be(0);
131
- });
132
-
133
- scenario("Usuário não logado tenta finalizar compra", () => {
134
- user.respondsWith({ loggedIn: false });
135
- const checkout = standIn();
136
- checkout.respondsWith({ error: "LOGIN_REQUIRED", status: 401 });
137
-
138
- to(checkout.status).be(401);
139
- });
140
- });
141
-
142
- // =============================================================================
143
- // 🛡️ CAMADA IMPERATIVA: Integração com Gateway de Pagamento
144
- // =============================================================================
145
- // Aqui verificamos contratos rígidos com sistemas externos.
146
- // A linguagem é autoritária: ensure, verify, check.
147
-
148
- ensure("Conformidade com Gateway de Pagamento v2.1", () => {
149
- const paymentGateway = stub();
150
- const transactionLogger = stub();
151
-
152
- initAll(() => {
153
- // Setup de infraestrutura
154
- paymentGateway.process.forceReturn({
155
- status: 200,
156
- transactionId: "tx_abc123",
157
- timestamp: "2026-01-01T00:00:00Z",
158
- });
159
- transactionLogger.log.forceReturn(true);
160
- });
161
-
162
- reset(() => {
163
- // Limpa estado entre testes para garantir contagens precisas
164
- paymentGateway.clear();
165
- transactionLogger.clear();
166
- });
167
-
168
- check("Transação bem-sucedida retorna status 200", () => {
169
- const response = paymentGateway.process({
170
- amount: 99.9,
171
- currency: "BRL",
172
- cardToken: "tok_visa_xxxx",
173
- });
174
-
175
- that(response.status).is(200);
176
- that(response.transactionId).matches(/^tx_[a-z0-9]+$/);
177
- });
178
-
179
- check("TransactionId segue padrão RFC do contrato", () => {
180
- const response = paymentGateway.process({ amount: 50 });
181
-
182
- // Validação rigorosa do formato do ID
183
- that(response.transactionId).matches(/^tx_[a-z0-9]{6,}$/);
184
- that(response.timestamp).matches(/^\d{4}-\d{2}-\d{2}T/);
185
- });
186
-
187
- check("Toda transação deve ser logada para auditoria", () => {
188
- paymentGateway.process({ amount: 100 });
189
- transactionLogger.log({ event: "PAYMENT_PROCESSED" });
190
-
191
- that(transactionLogger).triggered();
192
- that(transactionLogger).calledWith({ event: "PAYMENT_PROCESSED" });
193
- });
194
-
195
- check("Gateway deve ser acionado exatamente uma vez por request", () => {
196
- paymentGateway.process({ amount: 100 });
197
- that(paymentGateway).triggeredCount(1);
198
- });
199
- });
200
-
201
- // =============================================================================
202
- // 🎭 RESUMO: Por que usar os 3 dialetos?
203
- // =============================================================================
204
- //
205
- // | Camada | Dialeto | Por quê? |
206
- // |--------------|-------------|----------------------------------------------|
207
- // | Cálculos | Matemático | Provas de verdades universais, sem estado |
208
- // | UX/Jornada | Narrativo | Documentação viva legível por PMs |
209
- // | Integração | Imperativo | Contratos rígidos, conformidade, auditoria |
210
- //
211
- // Cada dialeto expressa a NATUREZA do problema que está resolvendo.
212
- // A linguagem do teste espelha a linguagem do domínio.
@@ -1,54 +0,0 @@
1
- import {
2
- MathDialect,
3
- NarrativeDialect,
4
- ImperativeDialect,
5
- } from "../src/index.js";
6
-
7
- console.log("---------------------------------------------------");
8
- console.log("🚀 INICIANDO TEST SUITE POLIGLOTA TEMPLATE");
9
- console.log("---------------------------------------------------");
10
-
11
- // 1. Teste Matemático
12
- const { axiom, proof, implies, arbitrary } = MathDialect;
13
-
14
- axiom("Teoria dos Conjuntos (Dialeto Matemático)", () => {
15
- const f = arbitrary();
16
- f.yields(10); // Configuração usando nome matemático
17
-
18
- proof("f deve mapear para 10", () => {
19
- const res = f();
20
- implies(res).is(10);
21
- implies(f).wasEvaluated();
22
- });
23
- });
24
-
25
- // 2. Teste Narrativo
26
- const { intend, detail, to, standIn } = NarrativeDialect;
27
-
28
- intend("Autenticação de Usuário (Dialeto Narrativo)", () => {
29
- const login = standIn();
30
- login.respondsWith(true); // Configuração narrativa
31
-
32
- detail("login bem sucedido", () => {
33
- login("user", "pass");
34
- to(login).received("user", "pass");
35
- to(login).wasCalled();
36
- });
37
- });
38
-
39
- // 3. Teste Imperativo
40
- const { ensure, check, that, stub } = ImperativeDialect;
41
-
42
- ensure("Serviço de Pagamento (Dialeto Imperativo)", () => {
43
- const api = stub();
44
- api.forceReturn(200); // Configuração imperativa
45
-
46
- check("status da API é 200", () => {
47
- const status = api();
48
- that(status).is(200);
49
- that(api).triggeredCount(1);
50
- });
51
- });
52
-
53
- console.log("\n---------------------------------------------------");
54
- console.log("🏁 FIM DA EXECUÇÃO");
@@ -1,70 +0,0 @@
1
- import { ApiSpec } from "../packages/api-test-dialect/index.js";
2
-
3
- /**
4
- * 🌐 Teste de Showcase do Dialeto de API
5
- * Mostrando todas as funcionalidades integradas:
6
- * - GET, POST, PUT, DELETE
7
- * - Headers customizados
8
- * - Validação de Status Code
9
- * - Validação de Schema (Nominal/Semântica)
10
- */
11
-
12
- async function runShowcase() {
13
- const BASE_URL = "https://jsonplaceholder.typicode.com";
14
-
15
- console.log("\n--- 🚀 INICIANDO SHOWCASE DE FUNCIONALIDADES API ---");
16
-
17
- try {
18
- // 1. Teste GET Simples
19
- await ApiSpec.define("1. Buscar Post Único (GET)")
20
- .from(BASE_URL)
21
- .get("/posts/1")
22
- .shouldReturn(200)
23
- .matchingSchema({
24
- id: 1,
25
- userId: 1,
26
- title: "string",
27
- body: "string"
28
- })
29
- .run();
30
-
31
- // 2. Teste POST com Body e Header
32
- await ApiSpec.define("2. Criar Novo Recurso (POST)")
33
- .from(BASE_URL)
34
- .header("Content-Type", "application/json; charset=UTF-8")
35
- .header("X-Custom-Header", "vibe2founderPower")
36
- .post("/posts", {
37
- title: "Showcase Test",
38
- body: "Testando todas as features do dialeto",
39
- userId: 1
40
- })
41
- .shouldReturn(201)
42
- .run();
43
-
44
- // 3. Teste PUT (Atualização)
45
- await ApiSpec.define("3. Atualizar Recurso (PUT)")
46
- .from(BASE_URL)
47
- .put("/posts/1", {
48
- id: 1,
49
- title: "Título Atualizado",
50
- body: "Conteúdo atualizado via PUT",
51
- userId: 1
52
- })
53
- .shouldReturn(200)
54
- .run();
55
-
56
- // 4. Teste DELETE
57
- await ApiSpec.define("4. Remover Recurso (DELETE)")
58
- .from(BASE_URL)
59
- .delete("/posts/1")
60
- .shouldReturn(200)
61
- .run();
62
-
63
- console.log("\n--- ✅ SHOWCASE FINALIZADO COM SUCESSO ---");
64
- } catch (err: any) {
65
- console.error("\n--- ❌ SHOWCASE FALHOU ---");
66
- // O erro já é logado pelo dialeto no .run()
67
- }
68
- }
69
-
70
- runShowcase();
@@ -1,36 +0,0 @@
1
- import { ApiSpec } from "../packages/api-test-dialect/index.js";
2
-
3
- // Simulating a test run against a public placeholder API (JSONPlaceholder)
4
- async function runExample() {
5
- try {
6
- console.log("--- Starting API Dialect Test Example ---");
7
-
8
- await ApiSpec.define("Get Single Post")
9
- .from("https://jsonplaceholder.typicode.com")
10
- .get("/posts/1")
11
- .shouldReturn(200)
12
- .matchingSchema({
13
- id: 1,
14
- userId: 1,
15
- title: "string",
16
- body: "string",
17
- })
18
- .run();
19
-
20
- await ApiSpec.define("Create New Post")
21
- .from("https://jsonplaceholder.typicode.com")
22
- .post("/posts", {
23
- title: "vibe2founder Test",
24
- body: "Building dialects is fun",
25
- userId: 1,
26
- })
27
- .shouldReturn(201)
28
- .run();
29
-
30
- console.log("--- All tests finished successfully ---");
31
- } catch (error) {
32
- // Error is already logged by the dialect
33
- }
34
- }
35
-
36
- runExample();
Binary file
Binary file
Binary file
@@ -1,38 +0,0 @@
1
- # 🚀 Engineering the "One Proof 4 All" Landing Page
2
-
3
- ## The Vision
4
- The objective was to create a landing page that reflects the **Poliglota** and **Additive** philosophy of the `one-spec-4-all` testing framework. We wanted a design that screams "State of the Art" while being informative and accessible.
5
-
6
- ## How it was built
7
- We used a modern tech stack centered around performance and developer experience:
8
- - **Vite + React**: For an ultra-fast development cycle and efficient rendering.
9
- - **Tailwind CSS**: For a tailored, utility-first design system. We defined custom semantic colors for each testing dialect:
10
- - 📐 **Math**: Indigo
11
- - 📖 **Narrative**: Emerald
12
- - 🛡️ **Imperative**: Amber
13
- - 🚀 **API Spec**: Rose
14
- - **Framer Motion**: To create "Elastic" and smooth transitions that make the page feel alive and responsive.
15
- - **Lucide Icons**: For clean and modern visual cues.
16
-
17
- ## How it works
18
- The page is built as a single-page application with several strategic sections:
19
- 1. **The Hero**: A bold, high-contrast entrance emphasizing the "One Proof" message.
20
- 2. **The "Zero Risk" Pillar**: Communicating the additive nature of the framework—compatible with legacy Jest.
21
- 3. **The Interactive Dialect Studio**: Users can switch between dialects to see how the syntax changes to fit the domain.
22
- 4. **Targeted Value Propositions**: Specific sections for Data Scientists, Architects, and PMs.
23
-
24
- ## Design Aesthetics
25
- We opted for a **Deep Dark** theme (`#0a0a0a`) with:
26
- - **Glassmorphism**: Using `backdrop-blur` and semi-transparent borders to create depth.
27
- - **Glow Effects**: Radial gradients in the background to prevent a "flat" look.
28
- - **Typography**: Inter for the body and JetBrains Mono for code snippets, ensuring high legibility.
29
-
30
- ## How to Test
31
- 1. Make sure you have **Bun** installed.
32
- 2. Enter the directory: `cd landing-page`
33
- 3. Install dependencies: `bun install`
34
- 4. Start development: `bun run dev`
35
- 5. Experience the future of testing.
36
-
37
- ---
38
- *Created by Antigravity - Advanced Agentic Coding @ Google Deepmind*