Files
openstapps/test/aggregations.spec.ts
2020-11-30 17:21:12 +01:00

72 lines
2.5 KiB
TypeScript

/*
* Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* 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 {slow, suite, test, timeout} from '@testdeck/mocha';
import {MapAggTest} from './mapping-model/MapAggTest';
import {aggArrayTest} from './mapping-model/aggregations/src/agg-array';
import {aggNestedTest} from './mapping-model/aggregations/src/agg-nested';
import {aggGlobalTest} from './mapping-model/aggregations/src/agg-global';
import {aggGlobalNestedTest} from './mapping-model/aggregations/src/agg-global-nested';
import {aggInheritedTest} from './mapping-model/aggregations/src/agg-inherited';
import {aggInheritedGlobalTest} from './mapping-model/aggregations/src/agg-inherited-global';
import {aggInheritedOverwrittenTest} from './mapping-model/aggregations/src/agg-inherited-overwritten';
process.on('unhandledRejection', (error: unknown) => {
if (error instanceof Error) {
void Logger.error('UNHANDLED REJECTION', error.stack);
}
process.exit(1);
});
const magAppInstance = new MapAggTest('aggregations');
@suite(timeout(20000), slow(10000))
export class AggregationsSpec {
@test
async 'Aggregation tag should propagate on arrays'() {
magAppInstance.testInterfaceAgainstPath(aggArrayTest);
}
@test
async 'Should work on nested properties'() {
magAppInstance.testInterfaceAgainstPath(aggNestedTest);
}
@test
async 'Global option should work'() {
magAppInstance.testInterfaceAgainstPath(aggGlobalTest);
}
@test
async 'Global aggregations when nested'() {
magAppInstance.testInterfaceAgainstPath(aggGlobalNestedTest);
}
@test
async 'Inherited aggregations should work'() {
magAppInstance.testInterfaceAgainstPath(aggInheritedTest);
}
@test
async 'Inherited global aggregations should work'() {
magAppInstance.testInterfaceAgainstPath(aggInheritedGlobalTest);
}
@test
async 'Inherited aggregations should work when overwritten'() {
magAppInstance.testInterfaceAgainstPath(aggInheritedOverwrittenTest);
}
}