Browse Source

Merge pull request #21 from CorpGlory/tests-recovery

Tests recovery
dependabot/npm_and_yarn/node-notifier-8.0.1
Coin de Gamma 3 years ago committed by GitHub
parent
commit
2e44e7a008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitignore
  2. 20
      .vscode/launch.json
  3. 2
      bin.tsconfig.json
  4. 26
      jest.config.js
  5. 0
      lib.tsconfig.json
  6. 6
      package.json
  7. 13
      spec/elasticsearch.jest.ts
  8. 3
      tsconfig.jest.json

1
.gitignore vendored

@ -2,6 +2,5 @@ dist/
dist-test/
node_modules/
npm-debug.log
.vscode/
lib/
bin/

20
.vscode/launch.json vendored

@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}

2
tsconfig.bin.json → bin.tsconfig.json

@ -6,5 +6,5 @@
"outFile": "bin/tsdb-kit.js"
},
"include": [ "src/**/*.ts" ],
"exclude": [ "src/index.ts" ]
"exclude": [ "src/index.ts" ]
}

26
jest.config.js

@ -1,21 +1,11 @@
module.exports = {
"verbose": true,
"globals": {
"ts-jest": {
"useBabelrc": true,
"tsConfigFile": "tsconfig.jest.json"
}
},
"transform": {
"\\.ts": "ts-jest"
},
"testRegex": "(\\.|/)([jt]est)\\.[jt]s$",
"moduleFileExtensions": [
"ts",
"js",
"json"
],
"setupFiles": [
verbose: true,
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: [
"<rootDir>/spec/setup_tests.ts"
]
],
// TODO: folder structure defualt for jest, so
// no preference about the testRegex
testRegex: "(\\.|/)([jt]est)\\.[jt]s$"
};

0
tsconfig.lib.json → lib.tsconfig.json

6
package.json

@ -4,10 +4,10 @@
"description": "",
"scripts": {
"build": "yarn build:lib && yarn build:bin",
"build:lib": "tsc --p tsconfig.lib.json",
"build:bin": "tsc --p tsconfig.bin.json",
"build:lib": "tsc --p lib.tsconfig.json",
"build:bin": "tsc --p bin.tsconfig.json",
"dev": "tsc -w",
"test": "jest --config jest.config.js"
"test": "jest"
},
"repository": {
"type": "git",

13
spec/elasticsearch.jest.ts

@ -30,7 +30,7 @@ describe('simple query', function(){
{
"query_string": {
"analyze_wildcard": true,
"query": "beat.hostname:opt-project.ru AND !system.network.name:\"IBM USB Remote NDIS Network Device\""
"query": "beat.hostname:example.com AND !system.network.name:\"IBM USB Remote NDIS Network Device\""
}
}
]
@ -100,7 +100,7 @@ describe('simple query', function(){
"type": "derivative"
}
],
"query": "beat.hostname:opt-project.ru AND !system.network.name:\"IBM USB Remote NDIS Network Device\"",
"query": "beat.hostname:example.com AND !system.network.name:\"IBM USB Remote NDIS Network Device\"",
"refId": "A",
"target": "carbon.agents.0b0226864dc8-a.cpuUsage",
"timeField": "@timestamp"
@ -129,7 +129,7 @@ describe('simple query', function(){
{
"query_string": {
"analyze_wildcard": true,
"query": "beat.hostname:opt-project.ru AND !system.network.name:\"IBM USB Remote NDIS Network Device\""
"query": "beat.hostname:example.com AND !system.network.name:\"IBM USB Remote NDIS Network Device\""
}
}
]
@ -167,6 +167,9 @@ describe('simple query', function(){
it('check correct time processing', function() {
let expectedQuery = {
headers: {
'Content-Type': 'application/json'
},
url: datasourse.url,
method: 'POST',
schema: {
@ -179,7 +182,9 @@ describe('simple query', function(){
let limit = 222;
let offset = 333;
expect(elasticMetric.getQuery(from, to, limit, offset)).toEqual(expectedQuery);
let result = elasticMetric.getQuery(from, to, limit, offset);
expect(result).toEqual(expectedQuery);
});

3
tsconfig.jest.json

@ -1,3 +0,0 @@
{
"extends": "./tsconfig"
}
Loading…
Cancel
Save