test: add type alias annotation test

This commit is contained in:
Wieland Schöbl
2020-11-25 11:05:22 +01:00
parent abdd62a4db
commit 058de208db
36 changed files with 119 additions and 64 deletions

View File

@@ -1,4 +1,3 @@
// tslint:disable
/* /*
* Copyright (C) 2020 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,4 +1,3 @@
// tslint:disable
/* /*
* Copyright (C) 2020 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,3 +1,17 @@
/*
* 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 {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../MapAggTestOptions'; import {MapAggTestOptions} from '../../MapAggTestOptions';
import {ElasticsearchDataType} from '../../../../src/mappings/definitions/typemap'; import {ElasticsearchDataType} from '../../../../src/mappings/definitions/typemap';

View File

@@ -0,0 +1,67 @@
/*
* 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 {ThingType} from './types';
import {MapAggTestOptions} from '../../MapAggTestOptions';
import {ElasticsearchDataType} from '../../../../src/mappings/definitions/typemap';
/**
* @indexable
*/
export interface TypeAlias {
/**
*
*/
textProperty: ATextAlias,
/**
*
*/
keywordProperty: AKeywordAlias,
/**
* @keyword
*/
overriddenKeyword: ATextAlias
type: ThingType.TypeAlias;
}
/**
* @text
*/
type ATextAlias = string;
/**
* @keyword
*/
type AKeywordAlias = string;
export const typeAliasTest: MapAggTestOptions = {
name: ThingType.TypeAlias,
map: {
maps: {
textProperty: {
type: ElasticsearchDataType.text,
},
keywordProperty: {
type: ElasticsearchDataType.keyword,
},
overriddenKeyword: {
type: ElasticsearchDataType.text,
},
}
}
};

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.

View File

@@ -1,6 +1,5 @@
// tslint:disable
/* /*
* Copyright (C) 2019 StApps * Copyright (C) 2020 StApps
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -37,4 +36,5 @@ export enum ThingType {
AnyUnknown = 'any unknown', AnyUnknown = 'any unknown',
InheritTags = 'inherit tags', InheritTags = 'inherit tags',
TagsIgnoreCase = 'tags ignore case', TagsIgnoreCase = 'tags ignore case',
TypeAlias = 'type alias',
} }

View File

@@ -35,6 +35,7 @@ import {pairedTagsTest} from './mapping-model/mappings/src/paired-tags';
import {filterableTagTest} from './mapping-model/mappings/src/filterable-tag'; import {filterableTagTest} from './mapping-model/mappings/src/filterable-tag';
import {anyUnknownTest} from './mapping-model/mappings/src/any-unknown'; import {anyUnknownTest} from './mapping-model/mappings/src/any-unknown';
import {tagsIgnoreCaseTest} from './mapping-model/mappings/src/tags-ignore-case'; import {tagsIgnoreCaseTest} from './mapping-model/mappings/src/tags-ignore-case';
import {typeAliasTest} from './mapping-model/mappings/src/type-alias';
process.on('unhandledRejection', (error: unknown) => { process.on('unhandledRejection', (error: unknown) => {
if (error instanceof Error) { if (error instanceof Error) {
@@ -108,6 +109,11 @@ export class MappingSpec {
magAppInstance.testInterfaceAgainstPath(typeQueryTest); magAppInstance.testInterfaceAgainstPath(typeQueryTest);
}*/ }*/
@test
async 'Type alias annotations should work'(){
magAppInstance.testInterfaceAgainstPath(typeAliasTest);
}
@test @test
async 'Impossible union should cause an error'() { async 'Impossible union should cause an error'() {
magAppInstance.testInterfaceAgainstPath(impossibleUnionTest); magAppInstance.testInterfaceAgainstPath(impossibleUnionTest);