Skip to content

Commit 7bd3e80

Browse files
committed
fix(core): resolve lint and type errors
1 parent d3811e4 commit 7bd3e80

File tree

3 files changed

+48
-17
lines changed

3 files changed

+48
-17
lines changed

packages/core/test/e2e.test.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ describe('E2E: execute (internal)', () => {
108108
expect(response.ok).toBe(true);
109109

110110
const json = (await response.json()) as { args: Record<string, string> };
111-
expect(json.args.foo).toBe('bar');
112-
expect(json.args.baz).toBe('qux');
111+
expect(json.args['foo']).toBe('bar');
112+
expect(json.args['baz']).toBe('qux');
113113
});
114114

115115
test('basic authentication', async () => {
@@ -193,10 +193,12 @@ Accept: application/json
193193
const requests = parse(content);
194194
expect(requests).toHaveLength(1);
195195

196+
const request = requests[0];
197+
if (!request) throw new Error('Expected request');
196198
const response = await execute({
197-
method: requests[0]?.method,
198-
url: requests[0]?.url,
199-
headers: requests[0]?.headers
199+
method: request.method,
200+
url: request.url,
201+
headers: request.headers
200202
});
201203

202204
expect(response.ok).toBe(true);
@@ -211,11 +213,13 @@ Content-Type: application/json
211213
`;
212214

213215
const requests = parse(content);
216+
const request = requests[0];
217+
if (!request) throw new Error('Expected request');
214218
const response = await execute({
215-
method: requests[0]?.method,
216-
url: requests[0]?.url,
217-
headers: requests[0]?.headers,
218-
body: requests[0]?.body
219+
method: request.method,
220+
url: request.url,
221+
headers: request.headers,
222+
...(request.body !== undefined && { body: request.body })
219223
});
220224

221225
expect(response.ok).toBe(true);
@@ -275,7 +279,9 @@ describe('E2E: createClient', () => {
275279
expect(response.ok).toBe(true);
276280

277281
const json = (await response.json()) as { args: Record<string, string> };
278-
expect(parseInt(json.args.t, 10)).toBeGreaterThan(0);
282+
const timestamp = json.args['t'];
283+
expect(timestamp).toBeDefined();
284+
expect(parseInt(timestamp ?? '', 10)).toBeGreaterThan(0);
279285
});
280286

281287
test('client tracks and reuses cookies', async () => {
@@ -297,7 +303,7 @@ describe('E2E: createClient', () => {
297303
const response = await client.run(`${FIXTURES}/get-cookies.http`);
298304

299305
const json = (await response.json()) as { cookies: Record<string, string> };
300-
expect(json.cookies.session).toBe('abc123');
306+
expect(json.cookies['session']).toBe('abc123');
301307
});
302308

303309
test('client setVariable updates state', async () => {
@@ -311,8 +317,8 @@ describe('E2E: createClient', () => {
311317
const response = await client.run(`${FIXTURES}/get-with-query.http`);
312318

313319
const json = (await response.json()) as { args: Record<string, string> };
314-
expect(json.args.a).toBe('value2');
315-
expect(json.args.b).toBe('value3');
320+
expect(json.args['a']).toBe('value2');
321+
expect(json.args['b']).toBe('value3');
316322
});
317323
});
318324

packages/webdocs/src/content/docs/docs/getting-started.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ t-req parses, interpolates, and executes `.http` files in JavaScript. It works a
88
## Install
99

1010
```bash
11-
npm install -g @t-req/app
11+
curl -fsSL https://t-req.io/install.sh | bash
1212
```
1313

14-
Or with other package managers:
14+
Or with a package manager:
1515

1616
```bash
17+
npm install -g @t-req/app
1718
bun add -g @t-req/app
1819
pnpm add -g @t-req/app
1920
```

packages/webdocs/src/pages/index.astro

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,21 @@ console.<span class="fn">log</span>(<span class="kw">await</span> response.<span
251251
<p class="section-subtitle">Get up and running in seconds.</p>
252252

253253
<div class="max-w-2xl mx-auto">
254+
<!-- Curl Install -->
255+
<div class="quickstart-card quickstart-featured">
256+
<h3 class="quickstart-title">Install with curl</h3>
257+
<pre
258+
class="quickstart-code"><code>curl -fsSL https://t-req.io/install.sh | bash</code></pre>
259+
<p class="quickstart-note">
260+
Then create a new project and start exploring:
261+
</p>
262+
<pre
263+
class="quickstart-code"><code>treq init my-api && cd my-api && treq open</code></pre>
264+
</div>
265+
254266
<!-- CLI Install -->
255-
<div class="quickstart-card">
256-
<h3 class="quickstart-title">Use the CLI</h3>
267+
<div class="quickstart-card mt-6">
268+
<h3 class="quickstart-title">Or install via npm</h3>
257269
<div class="install-tabs-wrapper">
258270
<div class="flex flex-wrap gap-2 mb-4">
259271
<button class="install-tab active" data-tab="npm">npm</button>
@@ -746,6 +758,18 @@ treq open</code></pre>
746758
color: #0f172a;
747759
background-color: #e2e8f0;
748760
}
761+
762+
/* Featured quickstart card */
763+
.quickstart-featured {
764+
border-color: #f97316;
765+
background: linear-gradient(to bottom right, #fff7ed, #ffffff);
766+
}
767+
768+
.quickstart-note {
769+
font-size: 0.875rem;
770+
color: #64748b;
771+
margin: 1rem 0 0.75rem;
772+
}
749773
</style>
750774

751775
<script>

0 commit comments

Comments
 (0)