mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
feat: tests
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
"author": "Thea Schöbl <dev@theaninova.de>",
|
||||
"scripts": {
|
||||
"build": "rimraf lib && tsc",
|
||||
"format": "prettier .",
|
||||
"format:fix": "prettier --write .",
|
||||
"format": "prettier . --ignore-path ../../.gitignore",
|
||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||
"lint": "eslint -c .eslintrc --ignore-path .eslintignore --ext .ts src/ test/",
|
||||
"lint:fix": "eslint --fix -c .eslintrc --ignore-path .eslintignore --ext .ts src/ test/",
|
||||
"test": "mocha --require ts-node/register test/*.spec.ts"
|
||||
"test": "c8 mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/elasticsearch": "8.4.0",
|
||||
@@ -38,9 +38,10 @@
|
||||
"@types/rimraf": "3.0.2",
|
||||
"chai": "4.3.7",
|
||||
"mocha": "10.2.0",
|
||||
"c8": "7.13.0",
|
||||
"nock": "13.3.0",
|
||||
"rimraf": "5.0.0",
|
||||
"ts-node": "10.9.1",
|
||||
"rimraf": "5.0.0"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config"
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ import {mkdirSync, readFileSync, writeFileSync} from 'fs';
|
||||
import got from 'got';
|
||||
import path from 'path';
|
||||
import {exit} from 'process';
|
||||
import {generateTemplate} from './mapping.js';
|
||||
import {getProjectReflection} from './project-reflection.js';
|
||||
import {ElasticsearchTemplateCollection} from './types/mapping.js';
|
||||
import {generateTemplate} from './mapping';
|
||||
import {getProjectReflection} from './project-reflection';
|
||||
import {ElasticsearchTemplateCollection} from './types/mapping';
|
||||
|
||||
// handle unhandled promise rejections
|
||||
process.on('unhandledRejection', async (reason: unknown) => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {MappingFloatNumberProperty} from '@elastic/elasticsearch/lib/api/types';
|
||||
import {ElasticsearchTypemap} from '../types/mapping.js';
|
||||
import {ElasticsearchTypemap} from '../types/mapping';
|
||||
|
||||
export const PARSE_ERROR = 'PARSE_ERROR' as MappingFloatNumberProperty['type'];
|
||||
export const MISSING_PREMAP = 'MISSING_PREMAP' as MappingFloatNumberProperty['type'];
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export * from './mapping'
|
||||
export * from './project-reflection'
|
||||
export * from './config/premap'
|
||||
export * from './config/fieldmap'
|
||||
export * from './config/settings'
|
||||
export * from './config/typemap'
|
||||
export * from './mapping';
|
||||
export * from './project-reflection';
|
||||
|
||||
export * from './config/premap';
|
||||
export * from './config/fieldmap';
|
||||
export * from './config/settings';
|
||||
export * from './config/typemap';
|
||||
|
||||
export * from './types/mapping';
|
||||
export * from './types/aggregation';
|
||||
|
||||
@@ -33,13 +33,13 @@ import {
|
||||
TypeParameterType,
|
||||
UnionType,
|
||||
} from 'typedoc/dist/lib/models';
|
||||
import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap.js';
|
||||
import {premaps} from './config/premap.js';
|
||||
import {settings} from './config/settings.js';
|
||||
import {dynamicTypes, isTagType, MISSING_PREMAP, PARSE_ERROR, TYPE_CONFLICT, typemap} from './config/typemap.js';
|
||||
import {AggregationSchema, ESNestedAggregation} from './types/aggregation.js';
|
||||
import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap';
|
||||
import {premaps} from './config/premap';
|
||||
import {settings} from './config/settings';
|
||||
import {dynamicTypes, isTagType, MISSING_PREMAP, PARSE_ERROR, TYPE_CONFLICT, typemap} from './config/typemap';
|
||||
import {AggregationSchema, ESNestedAggregation} from './types/aggregation';
|
||||
import {ElasticsearchTemplateCollection,
|
||||
MappingGenTemplate} from './types/mapping.js';
|
||||
MappingGenTemplate} from './types/mapping';
|
||||
import * as console from 'console';
|
||||
|
||||
let dynamicTemplates: Record<string, MappingDynamicTemplate>[] = [];
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {readdirSync, statSync} from 'fs';
|
||||
import path from 'path';
|
||||
import {MapAggTest} from './mapping-model/map-agg-test.js';
|
||||
@@ -48,8 +47,8 @@ describe('ES Aggregation Gen', async () => {
|
||||
it(test.testName, function () {
|
||||
magAppInstance.testInterfaceAgainstPath(test);
|
||||
});
|
||||
} catch (error: any) {
|
||||
await Logger.error('UNHANDLED REJECTION', error.stack);
|
||||
} catch (error) {
|
||||
console.error('UNHANDLED REJECTION', (error as any).stack);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {ThingType} from './types.js';
|
||||
import {MapAggTestOptions} from '../../map-agg-test-options.js';
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export const testConfig: MapAggTestOptions = {
|
||||
dynamic: 'strict',
|
||||
properties: {
|
||||
baz: {
|
||||
type: 'float',
|
||||
type: ElasticsearchDataType.float,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {readdirSync, statSync} from 'fs';
|
||||
import path from 'path';
|
||||
import {MapAggTest} from './mapping-model/map-agg-test.js';
|
||||
@@ -49,8 +48,8 @@ describe('ES Mapping Gen', async () => {
|
||||
it(test.testName, function () {
|
||||
magAppInstance.testInterfaceAgainstPath(test);
|
||||
});
|
||||
} catch (error: any) {
|
||||
await Logger.error('UNHANDLED REJECTION', error.stack);
|
||||
} catch (error) {
|
||||
console.error('UNHANDLED REJECTION', (error as any).stack);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user