test: update outdated tests

This commit is contained in:
Kamil Myśliwiec
2023-04-17 14:05:50 +02:00
parent 11b7418e3f
commit f98c779e35
6 changed files with 22 additions and 99 deletions

View File

@@ -822,23 +822,6 @@
"token": "HttpAdapterHost"
}
},
"-553129559": {
"id": "-553129559",
"label": "HttpAdapterHost",
"parent": "555176277",
"metadata": {
"type": "provider",
"internal": true,
"sourceModuleName": "InternalCoreModule",
"durable": false,
"static": true,
"scope": 0,
"transient": false,
"exported": true,
"token": "HttpAdapterHost",
"initTime": 0
}
},
"-702581189": {
"id": "-702581189",
"label": "LazyModuleLoader",
@@ -2214,23 +2197,6 @@
},
"id": "1976848738"
},
"-1759625292": {
"source": "-553129559",
"target": "-326832201",
"metadata": {
"type": "class-to-class",
"sourceModuleName": "InternalCoreModule",
"sourceClassName": "HttpAdapterHost",
"targetClassName": "HttpAdapterHost",
"sourceClassToken": "HttpAdapterHost",
"targetClassToken": "HttpAdapterHost",
"targetModuleName": "InternalCoreModule",
"keyOrIndex": 0,
"injectionType": "constructor",
"internal": true
},
"id": "-1759625292"
},
"-2105726668": {
"source": "-1803759743",
"target": "1010833816",
@@ -2756,7 +2722,8 @@
"patterns": [
"createExternalSvc"
],
"isEventHandler": false
"isEventHandler": false,
"extras": {}
},
"id": "-349899408_create"
},
@@ -2771,7 +2738,8 @@
"patterns": [
"findAllExternalSvc"
],
"isEventHandler": false
"isEventHandler": false,
"extras": {}
},
"id": "-349899408_findAll"
},
@@ -2786,7 +2754,8 @@
"patterns": [
"findOneExternalSvc"
],
"isEventHandler": false
"isEventHandler": false,
"extras": {}
},
"id": "-349899408_findOne"
},
@@ -2801,7 +2770,8 @@
"patterns": [
"updateExternalSvc"
],
"isEventHandler": false
"isEventHandler": false,
"extras": {}
},
"id": "-349899408_update"
},
@@ -2816,7 +2786,8 @@
"patterns": [
"removeExternalSvc"
],
"isEventHandler": false
"isEventHandler": false,
"extras": {}
},
"id": "-349899408_remove"
}

View File

@@ -806,23 +806,6 @@
"token": "HttpAdapterHost"
}
},
"-553129559": {
"id": "-553129559",
"label": "HttpAdapterHost",
"parent": "555176277",
"metadata": {
"type": "provider",
"internal": true,
"sourceModuleName": "InternalCoreModule",
"durable": false,
"static": true,
"scope": 0,
"transient": false,
"exported": true,
"token": "HttpAdapterHost",
"initTime": 0
}
},
"-702581189": {
"id": "-702581189",
"label": "LazyModuleLoader",
@@ -2198,23 +2181,6 @@
},
"id": "1976848738"
},
"-1759625292": {
"source": "-553129559",
"target": "-326832201",
"metadata": {
"type": "class-to-class",
"sourceModuleName": "InternalCoreModule",
"sourceClassName": "HttpAdapterHost",
"targetClassName": "HttpAdapterHost",
"sourceClassToken": "HttpAdapterHost",
"targetClassToken": "HttpAdapterHost",
"targetModuleName": "InternalCoreModule",
"keyOrIndex": 0,
"injectionType": "constructor",
"internal": true
},
"id": "-1759625292"
},
"-2105726668": {
"source": "-1803759743",
"target": "1010833816",

View File

@@ -4,7 +4,7 @@ import { SerializedGraph } from '@nestjs/core/inspector/serialized-graph';
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
import { Test, TestingModule } from '@nestjs/testing';
import { expect } from 'chai';
import { readFileSync, writeFileSync } from 'fs';
import { readFileSync } from 'fs';
import { join } from 'path';
import * as sinon from 'sinon';
import { AppModule } from '../src/app.module';
@@ -26,10 +26,10 @@ describe('Graph inspector', () => {
const graph = testingModule.get(SerializedGraph);
// Update snapshot:
writeFileSync(
join(__dirname, 'fixtures', 'pre-init-graph.json'),
graph.toString(),
);
// writeFileSync(
// join(__dirname, 'fixtures', 'pre-init-graph.json'),
// graph.toString(),
// );
const snapshot = readFileSync(
join(__dirname, 'fixtures', 'pre-init-graph.json'),
@@ -54,10 +54,10 @@ describe('Graph inspector', () => {
const graph = testingModule.get(SerializedGraph);
// Update snapshot:
writeFileSync(
join(__dirname, 'fixtures', 'post-init-graph.json'),
graph.toString(),
);
// writeFileSync(
// join(__dirname, 'fixtures', 'post-init-graph.json'),
// graph.toString(),
// );
const snapshot = readFileSync(
join(__dirname, 'fixtures', 'post-init-graph.json'),

View File

@@ -145,7 +145,7 @@ describe('WebSocketGateway (WsAdapter)', () => {
}),
);
});
});
}).timeout(5000);
it(`should support 2 different gateways running on the same path (but different ports)`, async function () {
this.retries(10);

View File

@@ -1,5 +1,5 @@
import { Type } from '../../../common';
import { expect } from 'chai';
import { Type } from '../../../common';
import {
BadGatewayException,
BadRequestException,
@@ -220,15 +220,6 @@ describe('HttpException', () => {
const errorCause = new Error('An internal error cause');
const customDescription = 'custom description';
it('configures a cause when message is an instance of error', () => {
const message = new Error('Some Error');
const error = new HttpException(message, 400);
expect(`${error}`).to.be.eql(`HttpException: ${message.message}`);
const { cause } = error;
expect(cause).to.be.eql(message);
});
it('configures a cause when message is a string and the options object is passed', () => {
const error = new HttpException(customDescription, 400, {
cause: errorCause,

View File

@@ -376,7 +376,6 @@ describe('Module', () => {
(module as any)._imports = test;
expect(module.imports).to.be.eql(test);
expect(module.relatedModules).to.be.eql(test);
});
});
@@ -394,7 +393,6 @@ describe('Module', () => {
(module as any)._controllers = test;
expect(module.controllers).to.be.eql(test);
expect(module.routes).to.be.eql(test);
});
});
@@ -413,14 +411,11 @@ describe('Module', () => {
(module as any)._providers = test;
expect(module.providers).to.be.eql(test);
expect(module.components).to.be.eql(test);
});
});
describe('createModuleReferenceType', () => {
let moduleRef;
class SimpleClass {}
let moduleRef: any;
beforeEach(() => {
const Class = module.createModuleReferenceType();