Skip to content

Commit

Permalink
fix(eslint): add missing eslint dev deps
Browse files Browse the repository at this point in the history
  • Loading branch information
WonderPanda committed Jan 12, 2020
1 parent 1868fab commit 7bfcc2c
Show file tree
Hide file tree
Showing 5 changed files with 525 additions and 113 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -20,6 +20,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
"sonarjs/cognitive-complexity": ["error", 20]
},
ignorePatterns: ['*.d.ts']
};
9 changes: 8 additions & 1 deletion package.json
Expand Up @@ -21,14 +21,20 @@
"@types/jest": "^24.0.11",
"@types/lodash": "^4.14.120",
"@types/node": "^10.12.18",
"@typescript-eslint/eslint-plugin": "^2.15.0",
"@typescript-eslint/parser": "^2.15.0",
"commitizen": "^3.0.7",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-sonarjs": "^0.5.0",
"husky": "^1.3.1",
"jest": "^24.5.0",
"jest-junit": "^9.0.0",
"lerna": "^3.13.1",
"lint-staged": "^8.1.4",
"prettier": "^1.16.4",
"prettier": "^1.19.1",
"rimraf": "^2.6.3",
"ts-jest": "^24.0.0",
"typescript": "^3.3.3333"
Expand Down Expand Up @@ -57,6 +63,7 @@
"lint-staged": {
"*.ts": [
"yarn run prettier --write",
"yarn lint",
"git add"
],
"*.md": [
Expand Down
89 changes: 0 additions & 89 deletions packages/discovery/src/tests/provider-types.spec.ts
Expand Up @@ -136,93 +136,4 @@ describe.each(testCases)('Provider Types', (testCase: CaseType) => {
);
});
});

/* describe('Factory Providers', () => {
let app: TestingModule;
let discover: DiscoveryService;
beforeEach(async () => {
app = await Test.createTestingModule({
imports: [DiscoveryModule],
providers: [
{
provide: 'FactoryProviderKey',
useFactory: () => new DynamicProvider()
}
]
}).compile();
await app.init();
discover = app.get<DiscoveryService>(DiscoveryService);
});
it(providerMetadata, async () => {
providerMetadataTest(discover);
});
it(providerMethodMetadata, async () => {
const providerMethodMeta = await discover.providerMethodsWithMetaAtKey(
'test'
);
expect(providerMethodMeta.length).toBe(1);
const meta = providerMethodMeta[0];
expect(meta).toMatchObject({
meta: 'dynamicMethod',
discoveredMethod: {
methodName: 'doSomething',
parentClass: {
name: 'FactoryProviderKey'
}
}
});
expect(meta.discoveredMethod.parentClass.instance).toBeInstanceOf(
DynamicProvider
);
});
});
describe('Async Factory Providers', () => {
let app: TestingModule;
let discover: DiscoveryService;
beforeEach(async () => {
app = await Test.createTestingModule({
imports: [DiscoveryModule, ExampleModule]
}).compile();
await app.init();
discover = app.get<DiscoveryService>(DiscoveryService);
});
it(providerMetadata, async () => {
providerMetadataTest(discover);
});
it(providerMethodMetadata, async () => {
const providerMethodMeta = await discover.providerMethodsWithMetaAtKey(
'test'
);
expect(providerMethodMeta.length).toBe(1);
const meta = providerMethodMeta[0];
expect(meta).toMatchObject({
meta: 'dynamicMethod',
discoveredMethod: {
methodName: 'doSomething'
}
});
expect(meta.discoveredMethod.parentClass.instance).toBeInstanceOf(
DynamicProvider
);
});
}); */
});
15 changes: 4 additions & 11 deletions packages/rabbitmq/src/rabbitmq.spec.ts
Expand Up @@ -10,10 +10,6 @@ import { RabbitMQModule } from './rabbitmq.module';
jest.mock('./amqp/connection');
const MockedAmqpConnection = AmqpConnection as jest.Mock<AmqpConnection>;

// let MockedAmqpConnection = (AmqpConnection as unknown) as jest.Mocked<
// AmqpConnection
// >;

@Injectable()
class ExampleService {
@RabbitRPC({
Expand All @@ -38,7 +34,7 @@ class ExampleService {
})
class ExampleModule {}

function correctAmqpConnection(config: RabbitMQConfig) {
const expectAmqpCorrectUsage = (config: RabbitMQConfig) => {
expect(AmqpConnection).toBeCalledTimes(1);
expect(AmqpConnection).toBeCalledWith(config);

Expand All @@ -47,7 +43,7 @@ function correctAmqpConnection(config: RabbitMQConfig) {
>;

expect(amqpConnection.init).toBeCalledTimes(1);
}
};

describe('RabbitMQ', () => {
afterEach(() => {
Expand Down Expand Up @@ -76,7 +72,7 @@ describe('RabbitMQ', () => {
});

it('correctly configures the AmqpConnection', () => {
correctAmqpConnection(config);
expectAmqpCorrectUsage(config);
});
});

Expand Down Expand Up @@ -106,10 +102,7 @@ describe('RabbitMQ', () => {
});

it('correctly configures the AmqpConnection', () => {
correctAmqpConnection(config);

// console.log(MockedAmqpConnection);
// expect(MockedAmqpConnection.init.mock).toBeCalledTimes(1);
expectAmqpCorrectUsage(config);
});
});
});
Expand Down

0 comments on commit 7bfcc2c

Please sign in to comment.