@tsed/cli-plugin-jest 6.6.3 → 7.0.0-alpha.2
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/lib/esm/CliPluginJestModule.js +2 -0
- package/lib/esm/hooks/JestGenerateHook.js +28 -47
- package/lib/esm/hooks/JestInitHook.js +12 -25
- package/lib/esm/index.js +1 -1
- package/lib/esm/templates/controller.integration.template.js +35 -0
- package/lib/esm/templates/decorator.class.spec.template.js +22 -0
- package/lib/esm/templates/decorator.endpoint.spec.template.js +26 -0
- package/lib/esm/templates/decorator.method.spec.template.js +24 -0
- package/lib/esm/templates/decorator.param.spec.template.js +25 -0
- package/lib/esm/templates/decorator.parameter.spec.template.js +23 -0
- package/lib/esm/templates/decorator.prop.spec.template.js +26 -0
- package/lib/esm/templates/decorator.property.spec.template.js +24 -0
- package/lib/esm/templates/generic.spec.template.js +25 -0
- package/lib/esm/templates/index.js +12 -0
- package/lib/esm/templates/jest.config.template.js +84 -0
- package/lib/esm/templates/server.integration.template.js +30 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/types/CliPluginJestModule.d.ts +1 -0
- package/lib/types/hooks/JestGenerateHook.d.ts +5 -6
- package/lib/types/hooks/JestInitHook.d.ts +4 -9
- package/lib/types/index.d.ts +1 -1
- package/lib/types/templates/controller.integration.template.d.ts +2 -0
- package/lib/types/templates/decorator.class.spec.template.d.ts +2 -0
- package/lib/types/templates/decorator.endpoint.spec.template.d.ts +2 -0
- package/lib/types/templates/decorator.method.spec.template.d.ts +2 -0
- package/lib/types/templates/decorator.param.spec.template.d.ts +2 -0
- package/lib/types/templates/decorator.parameter.spec.template.d.ts +2 -0
- package/lib/types/templates/decorator.prop.spec.template.d.ts +2 -0
- package/lib/types/templates/decorator.property.spec.template.d.ts +2 -0
- package/lib/types/templates/generic.spec.template.d.ts +2 -0
- package/lib/types/templates/index.d.ts +11 -0
- package/lib/types/templates/jest.config.template.d.ts +2 -0
- package/lib/types/templates/server.integration.template.d.ts +2 -0
- package/package.json +8 -5
- package/src/CliPluginJestModule.ts +39 -0
- package/src/hooks/JestGenerateHook.ts +44 -0
- package/src/hooks/JestInitHook.ts +22 -0
- package/src/index.ts +5 -0
- package/src/templates/controller.integration.template.ts +38 -0
- package/src/templates/decorator.class.spec.template.ts +25 -0
- package/src/templates/decorator.endpoint.spec.template.ts +28 -0
- package/src/templates/decorator.method.spec.template.ts +26 -0
- package/src/templates/decorator.param.spec.template.ts +28 -0
- package/src/templates/decorator.parameter.spec.template.ts +26 -0
- package/src/templates/decorator.prop.spec.template.ts +28 -0
- package/src/templates/decorator.property.spec.template.ts +27 -0
- package/src/templates/generic.spec.template.ts +27 -0
- package/src/templates/index.ts +12 -0
- package/{templates/init/jest.config.mjs.hbs → src/templates/jest.config.template.ts} +18 -3
- package/src/templates/server.integration.template.ts +32 -0
- package/tsconfig.esm.json +27 -0
- package/vitest.config.mts +21 -0
- package/lib/esm/utils/templateDir.js +0 -2
- package/lib/types/utils/templateDir.d.ts +0 -1
- package/templates/generate/decorator.class.spec.hbs +0 -11
- package/templates/generate/decorator.endpoint.spec.hbs +0 -15
- package/templates/generate/decorator.method.spec.hbs +0 -13
- package/templates/generate/decorator.param.spec.hbs +0 -14
- package/templates/generate/decorator.parameter.spec.hbs +0 -12
- package/templates/generate/decorator.prop.spec.hbs +0 -15
- package/templates/generate/decorator.property.spec.hbs +0 -13
- package/templates/generate/generic.integration.hbs +0 -20
- package/templates/generate/generic.spec.hbs +0 -14
- package/templates/generate/server.integration.hbs +0 -20
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Store } from "@tsed/core";
|
|
2
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
3
|
-
|
|
4
|
-
describe("{{symbolName}}", () => {
|
|
5
|
-
it("should store options", () => {
|
|
6
|
-
class Test {
|
|
7
|
-
@{{symbolName}}({options: "options"})
|
|
8
|
-
method() param: string){}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const store = Store.fromMethod(Test, "method");
|
|
12
|
-
|
|
13
|
-
expect(store.get({{symbolName}})).toEqual({options: "options"});
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
2
|
-
|
|
3
|
-
describe("{{symbolName}}", () => {
|
|
4
|
-
it("should do something", () => {
|
|
5
|
-
class Test {
|
|
6
|
-
@{{symbolName}}({})
|
|
7
|
-
method(){}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
expect(typeof {{symbolName}}).toBe("function")
|
|
11
|
-
expect(typeof {{symbolName}}()).toBe("function")
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Store } from "@tsed/core";
|
|
2
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
3
|
-
|
|
4
|
-
describe("{{symbolName}}", () => {
|
|
5
|
-
it("should store options", () => {
|
|
6
|
-
class Test {
|
|
7
|
-
method(@{{symbolName}}({options: "options"}) param: string){}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const store = Store.from(Test, "method", 0)
|
|
11
|
-
|
|
12
|
-
expect(store.get({{symbolName}})).toEqual({options: "options"});
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
2
|
-
|
|
3
|
-
describe("{{symbolName}}", () => {
|
|
4
|
-
it("should do something", () => {
|
|
5
|
-
class Test {
|
|
6
|
-
method(@{{symbolName}}({}) param: string){}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
expect(typeof {{symbolName}}).toBe("function")
|
|
10
|
-
expect(typeof {{symbolName}}()).toBe("function")
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Store } from "@tsed/core";
|
|
2
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
3
|
-
|
|
4
|
-
describe("{{symbolName}}", () => {
|
|
5
|
-
it("should store options", () => {
|
|
6
|
-
class Test {
|
|
7
|
-
@{{symbolName}}({options: "options"})
|
|
8
|
-
property: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const store = Store.from(Test, "property");
|
|
12
|
-
|
|
13
|
-
expect(store.get({{symbolName}})).toEqual({options: "options"});
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
2
|
-
|
|
3
|
-
describe("{{symbolName}}", () => {
|
|
4
|
-
it("should do something", () => {
|
|
5
|
-
class Test {
|
|
6
|
-
@{{symbolName}}({})
|
|
7
|
-
property: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
expect(typeof {{symbolName}}).toBe("function")
|
|
11
|
-
expect(typeof {{symbolName}}()).toBe("function")
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PlatformTest } from "@tsed/platform-http/testing";
|
|
2
|
-
import SuperTest from "supertest";
|
|
3
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
4
|
-
import { Server } from "{{relativeSrcPath}}/Server.js";
|
|
5
|
-
|
|
6
|
-
describe("{{symbolName}}", () => {
|
|
7
|
-
beforeEach(PlatformTest.bootstrap(Server, {
|
|
8
|
-
mount: {
|
|
9
|
-
"/": [{{symbolName}}]
|
|
10
|
-
}
|
|
11
|
-
}));
|
|
12
|
-
afterEach(PlatformTest.reset);
|
|
13
|
-
|
|
14
|
-
it("should call GET {{route}}", async () => {
|
|
15
|
-
const request = SuperTest(PlatformTest.callback());
|
|
16
|
-
const response = await request.get("{{route}}").expect(200);
|
|
17
|
-
|
|
18
|
-
expect(response.text).toEqual("hello");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PlatformTest } from "@tsed/platform-http/testing";
|
|
2
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
3
|
-
|
|
4
|
-
describe("{{symbolName}}", () => {
|
|
5
|
-
beforeEach(PlatformTest.create);
|
|
6
|
-
afterEach(PlatformTest.reset);
|
|
7
|
-
|
|
8
|
-
it("should do something", () => {
|
|
9
|
-
const instance = PlatformTest.get<{{symbolName}}>({{symbolName}});
|
|
10
|
-
// const instance = PlatformTest.invoke<{{symbolName}}>({{symbolName}}); // get fresh instance
|
|
11
|
-
|
|
12
|
-
expect(instance).toBeInstanceOf({{symbolName}});
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PlatformTest } from "@tsed/platform-http/testing";
|
|
2
|
-
import SuperTest from "supertest";
|
|
3
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
4
|
-
|
|
5
|
-
describe("{{symbolName}}", () => {
|
|
6
|
-
beforeEach(PlatformTest.bootstrap({{symbolName}}));
|
|
7
|
-
afterEach(PlatformTest.reset);
|
|
8
|
-
|
|
9
|
-
it("should call GET {{route}}", async () => {
|
|
10
|
-
const request = SuperTest(PlatformTest.callback());
|
|
11
|
-
const response = await request.get("{{route}}").expect(404);
|
|
12
|
-
|
|
13
|
-
expect(response.body).toEqual({
|
|
14
|
-
errors: [],
|
|
15
|
-
message: 'Resource "/rest" not found',
|
|
16
|
-
name: "NOT_FOUND",
|
|
17
|
-
status: 404,
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|