Skip to content

Commit 474e2d8

Browse files
committed
docs: fix typo in testing and update configuration
1 parent 1555e20 commit 474e2d8

File tree

8 files changed

+40
-11
lines changed

8 files changed

+40
-11
lines changed

docs/.vitepress/config.mts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import team from "../team.json";
77

88
// https://vitepress.dev/reference/site-config
99
export default defineConfig({
10-
title: "Ts.ED a modern Node.js/Bun.js framework built with TypeScript",
10+
title: "Ts.ED a modern Node.js/Bun.js framework built with TypeScript on top of Express.js/Koa.js",
1111
lastUpdated: true,
1212
description: "Ts.ED offers a flexible and easy-to-learn structure designed to enhance the developer experience. It provides decorators, guidelines, and supports Node.js, Bun.js, Express, Koa, CLI, and serverless architectures (e.g., AWS).",
1313
sitemap: {
@@ -24,7 +24,7 @@ export default defineConfig({
2424
["meta", {name: "theme-color", content: "#5f67ee"}],
2525
["meta", {property: "og:type", content: "website"}],
2626
["meta", {property: "og:locale", content: "en"}],
27-
["meta", {property: "og:title", content: "Ts.ED - A Node.js and TypeScript Framework on top of Express/Koa.js."}],
27+
["meta", {property: "og:title", content: "Ts.ED a modern Node.js/Bun.js framework built with TypeScript on top of Express.js/Koa.js"}],
2828
["meta", {property: "og:site_name", content: "Ts.ED"}],
2929
["meta", {property: "og:image", content: "https://tsed.dev/tsed-og.png"}],
3030
["meta", {property: "og:url", content: "https://tsed.dev/"}],

docs/docs/configuration.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ It is also possible to split the configuration by using the @@Module@@:
152152

153153
- type: `string[]`
154154

155-
List of glob pattern to scan directories which contains [Services](/docs/prodivers)
155+
List of glob pattern to scan directories which contains [Services](/docs/providers)
156156
or [Middlewares](/docs/middlewares).
157157

158158
### middlewares
@@ -426,7 +426,7 @@ export class Server {}
426426
The configuration can be reused throughout your application in different ways.
427427

428428
- With dependency injection in [Controller](/docs/controllers), [Middleware](/docs/middlewares)
429-
, [Pipe](/docs/pipes) or any [Injectable](/docs/services) services.
429+
, [Pipe](/docs/pipes) or any [Injectable](/docs/providers) services.
430430
- With the decorators @@Constant@@ and @@Value@@.
431431

432432
### From service (DI)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {inject, runInContext} from "@tsed/di";
2+
import {PlatformTest} from "@tsed/platform-http/testing";
3+
import {CustomRepository} from "./CustomRepository";
4+
5+
describe("CustomRepository", () => {
6+
beforeEach(() => PlatformTest.create());
7+
afterEach(() => PlatformTest.reset());
8+
9+
it("should run method with the ctx", async () => {
10+
const ctx = PlatformTest.createRequestContext();
11+
const service = inject(CustomRepository);
12+
13+
ctx.request.headers = {
14+
"x-api": "api"
15+
};
16+
17+
const result = await runInContext(ctx, () => service.findById("id"));
18+
19+
expect(result).toEqual({
20+
id: "id",
21+
headers: {
22+
"x-api": "api"
23+
}
24+
});
25+
});
26+
});

docs/docs/snippets/request-context/testing/request-context-usage.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("CustomRepository", () => {
88

99
it("should run method with the ctx", async () => {
1010
const ctx = PlatformTest.createRequestContext();
11-
const service = inject(CustomRepository);
11+
const service = await PlatformTest.invoke(CustomRepository, []);
1212

1313
ctx.request.headers = {
1414
"x-api": "api"

docs/docs/testing.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ Here is an example of context usage:
6868

6969
To run a method with context in your unit test, you can use the @@runInContext@@ function:
7070

71-
<<< @/docs/snippets/request-context/testing/request-context-usage.spec.ts
71+
::: code-group
72+
<<< @/docs/snippets/request-context/fn/request-context-usage.ts [v7/v8]
73+
<<< @/docs/snippets/request-context/testing/request-context-usage.spec.ts [v8+]
74+
:::
7275

7376
## Mock dependencies
7477

docs/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ layout: home
44
head:
55
- - meta
66
- name: description
7-
content: Ts.ED is a modern Node.js framework built with TypeScript. It offers a flexible structure with a fast learning curve, specifically designed to improve the developer experience. Ts.ED provides numerous decorators and guidelines to make your code more readable and less error-prone. It supports various platforms and tools, including Node.js/Bun.js, Express.js/Koa.js, CLI, and serverless architectures (e.g., AWS).
7+
content: Ts.ED is a modern Bun.js/Node.js framework built with TypeScript on top of Express.js/Koa.js. It offers a flexible structure with a fast learning curve, specifically designed to improve the developer experience. Ts.ED provides numerous decorators and guidelines to make your code more readable and less error-prone. It supports various platforms and tools, including Node.js/Bun.js, Express.js/Koa.js, CLI, and serverless architectures (e.g., AWS).
88
- - meta
99
- name: keywords
1010
content: ts.ed framework express koa aws cli di rest graphql typescript node.js bun.js javascript native ESM decorators jsonschema class models providers pipes middlewares testing developer
1111

1212
hero:
1313
name: "Ts.ED"
1414
text: "A modern framework written in TypeScript"
15-
tagline: "A flexible framework with a fast learning curve, designed to enhance the developer experience"
15+
tagline: "A flexible framework on top of Express.js/Koa.js with a fast learning curve, designed to enhance the developer experience"
1616
actions:
1717
- theme: brand
1818
text: What is Ts.ED?

docs/tutorials/snippets/scalar/configuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "@tsed/platform-express";
2-
import "@tsed/scalar"; // import swagger Ts.ED module
2+
import "@tsed/scalar"; // import scalar Ts.ED module
33

44
import {Configuration} from "@tsed/di";
55

packages/specs/scalar/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ It also possible to create several swagger documentations with `doc` option:
8181

8282
```typescript
8383
import {Configuration} from "@tsed/di";
84-
import "@tsed/scalar"; // import swagger Ts.ED module
84+
import "@tsed/scalar"; // import scalar Ts.ED module
8585

8686
@Configuration({
8787
scalar: [
@@ -102,7 +102,7 @@ Then use `@Docs` decorators on your controllers to specify where the controllers
102102

103103
```typescript
104104
import {Controller} from "@tsed/di";
105-
import {Docs} from "@tsed/swagger";
105+
import {Docs} from "@tsed/scalar";
106106

107107
@Controller("/calendars")
108108
@Docs("api-v2") // display this controllers only for api-docs-v2

0 commit comments

Comments
 (0)