Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add @jest/globals for schematics #1324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/lib/application/files/ts/src/app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { beforeEach, describe, expect, it } from "@jest/globals";
import { Test, TestingModule } from "@nestjs/testing";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";

describe('AppController', () => {
describe("AppController", () => {
let appController: AppController;

beforeEach(async () => {
Expand All @@ -14,9 +15,9 @@ describe('AppController', () => {
appController = app.get<AppController>(AppController);
});

describe('root', () => {
describe("root", () => {
it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
expect(appController.getHello()).toBe("Hello World!");
});
});
});
17 changes: 9 additions & 8 deletions src/lib/application/files/ts/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
import { beforeEach, describe, expect, it } from "@jest/globals";
import { Test, TestingModule } from "@nestjs/testing";
import { INestApplication } from "@nestjs/common";
import * as request from "supertest";
import { AppModule } from "./../src/app.module";

describe('AppController (e2e)', () => {
describe("AppController (e2e)", () => {
let app: INestApplication;

beforeEach(async () => {
Expand All @@ -15,10 +16,10 @@ describe('AppController (e2e)', () => {
await app.init();
});

it('/ (GET)', () => {
it("/ (GET)", () => {
return request(app.getHttpServer())
.get('/')
.get("/")
.expect(200)
.expect('Hello World!');
.expect("Hello World!");
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Controller } from './<%= name %>.controller';

describe('<%= classify(name) %>Controller', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Gateway } from './<%= name %>.gateway';

describe('<%= classify(name) %>Gateway', () => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/library/files/ts/src/__name__.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Service } from './<%= name %>.service';

describe('<%= classify(name) %>Service', () => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/provider/files/ts/__name__.__specFileSuffix__.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(className) %> } from './<%= name %>';

describe('<%= classify(className) %>', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Resolver } from './<%= name %>.resolver';

describe('<%= classify(name) %>Resolver', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Controller } from './<%= name %>.controller';
import { <%= classify(name) %>Service } from './<%= name %>.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Gateway } from './<%= name %>.gateway';
import { <%= classify(name) %>Service } from './<%= name %>.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Resolver } from './<%= name %>.resolver';
import { <%= classify(name) %>Service } from './<%= name %>.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { <%= classify(name) %>Service } from './<%= name %>.service';

describe('<%= classify(name) %>Service', () => {
Expand Down