mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 00:23:03 +00:00
@@ -14,18 +14,18 @@
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
import {SCBulkResponse} from '../src/core/protocol/routes/bulk/BulkResponse';
|
||||
import {SCMultiSearchResponse} from '../src/core/protocol/routes/search/MultiSearchResponse';
|
||||
import {SCSearchResponse} from '../src/core/protocol/routes/search/SearchResponse';
|
||||
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
|
||||
import {SCDish} from '../src/core/things/Dish';
|
||||
import {SCBulkResponse} from '../src/protocol/routes/bulk-request';
|
||||
import {SCMultiSearchResponse} from '../src/protocol/routes/search-multi';
|
||||
import {SCSearchResponse} from '../src/protocol/routes/search';
|
||||
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
|
||||
import {SCDish} from '../src/things/dish';
|
||||
import {
|
||||
isBulkResponse,
|
||||
isMultiSearchResponse,
|
||||
isSearchResponse,
|
||||
isThing,
|
||||
isThingWithTranslations,
|
||||
} from '../src/core/types/Guards';
|
||||
} from '../src/guards';
|
||||
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class GuardsSpec {
|
||||
@@ -14,9 +14,9 @@
|
||||
*/
|
||||
import {expect} from 'chai';
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
import {SCBulkRoute} from '../src/core/protocol/routes/bulk/BulkRequest';
|
||||
import {SCBulkAddRoute} from '../src/core/protocol/routes/bulk/UID/BulkAddRequest';
|
||||
import {SCThingUpdateRoute} from '../src/core/protocol/routes/TYPE/UID/ThingUpdateRequest';
|
||||
import {SCBulkRoute} from '../src/protocol/routes/bulk-request';
|
||||
import {SCBulkAddRoute} from '../src/protocol/routes/bulk-add';
|
||||
import {SCThingUpdateRoute} from '../src/protocol/routes/thing-update';
|
||||
|
||||
@suite(timeout(10000), slow(5000))
|
||||
export class RoutesSpec {
|
||||
@@ -15,15 +15,14 @@
|
||||
import {expect} from 'chai';
|
||||
import clone = require('fast-clone');
|
||||
import {slow, suite, test, timeout} from 'mocha-typescript';
|
||||
|
||||
import {SCThingOriginType, SCThingType} from '../src/core/Thing';
|
||||
import {SCBuildingWithoutReferences} from '../src/core/things/Building';
|
||||
import {SCDish, SCDishMeta} from '../src/core/things/Dish';
|
||||
import {SCThingTranslator} from '../src/core/Translator';
|
||||
import {SCThingOriginType, SCThingType} from '../src/things/abstract/thing';
|
||||
import {SCBuildingWithoutReferences} from '../src/things/building';
|
||||
import {SCDish, SCDishMeta} from '../src/things/dish';
|
||||
import {SCThingTranslator} from '../src/translator';
|
||||
|
||||
const building: SCBuildingWithoutReferences = {
|
||||
address: {
|
||||
addressCountry : 'base-address.addressCountry',
|
||||
addressCountry: 'base-address.addressCountry',
|
||||
addressLocality: 'base-address.addressLocality',
|
||||
postalCode: 'base-address.postalCode',
|
||||
streetAddress: 'base-address.streetAddress',
|
||||
@@ -40,7 +39,7 @@ const building: SCBuildingWithoutReferences = {
|
||||
translations: {
|
||||
de: {
|
||||
address: {
|
||||
addressCountry : 'de-address.addressCountry',
|
||||
addressCountry: 'de-address.addressCountry',
|
||||
addressLocality: 'de-address.addressLocality',
|
||||
postalCode: 'de-address.postalCode',
|
||||
streetAddress: 'de-address.streetAddress',
|
||||
@@ -60,15 +59,15 @@ const dish: SCDish = {
|
||||
name: 'base-dish-name',
|
||||
offers: [
|
||||
{
|
||||
availability: 'in stock',
|
||||
inPlace: building,
|
||||
prices: {
|
||||
default: 23.42,
|
||||
},
|
||||
provider: {
|
||||
name: 'base-provider',
|
||||
type: SCThingType.Organization,
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217141',
|
||||
availability: 'in stock',
|
||||
inPlace: building,
|
||||
prices: {
|
||||
default: 23.42,
|
||||
},
|
||||
provider: {
|
||||
name: 'base-provider',
|
||||
type: SCThingType.Organization,
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217141',
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -110,7 +109,7 @@ export class TranslationSpecInplace {
|
||||
@test
|
||||
public directArrayOfString() {
|
||||
expect(translator.translate(dish).characteristics()).to.deep
|
||||
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
|
||||
.equal([{name: 'de-characteristic0'}, {name: 'de-characteristic1'}]);
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -161,7 +160,7 @@ export class TranslationSpecInplace {
|
||||
@test
|
||||
public directArrayOfStringSubscriptFallback() {
|
||||
expect(translatorWithFallback.translate(dish).characteristics[1]())
|
||||
.to.deep.equal({name: 'base-characteristic1'});
|
||||
.to.deep.equal({name: 'base-characteristic1'});
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -187,7 +186,7 @@ export class TranslationSpecInplace {
|
||||
@test
|
||||
public nestedMetaArrayOfStringFallback() {
|
||||
expect(translatorWithFallback.translate(dish).offers[0].inPlace.categories())
|
||||
.to.deep.equal(['office', 'education']);
|
||||
.to.deep.equal(['office', 'education']);
|
||||
}
|
||||
|
||||
@test
|
||||
@@ -1,29 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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 {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks';
|
||||
import {SCThing, SCThingWithoutReferences} from '../src/core/Thing';
|
||||
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/core/things/AcademicEvent';
|
||||
import {SCArticle, SCArticleWithoutReferences} from '../src/core/things/Article';
|
||||
import {SCBook, SCBookWithoutReferences} from '../src/core/things/Book';
|
||||
import {SCBuilding, SCBuildingWithoutReferences} from '../src/core/things/Building';
|
||||
import {SCCatalog, SCCatalogWithoutReferences} from '../src/core/things/Catalog';
|
||||
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/core/things/CourseOfStudies';
|
||||
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/core/things/DateSeries';
|
||||
import {SCDiff, SCDiffWithoutReferences} from '../src/core/things/Diff';
|
||||
import {SCDish, SCDishWithoutReferences} from '../src/core/things/Dish';
|
||||
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/core/things/Favorite';
|
||||
import {SCFloor, SCFloorWithoutReferences} from '../src/core/things/Floor';
|
||||
import {SCMessage, SCMessageWithoutReferences} from '../src/core/things/Message';
|
||||
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/core/things/Organization';
|
||||
import {SCPerson, SCPersonWithoutReferences} from '../src/core/things/Person';
|
||||
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/core/things/PointOfInterest';
|
||||
import {SCRoom, SCRoomWithoutReferences} from '../src/core/things/Room';
|
||||
import {SCSemester, SCSemesterWithoutReferences} from '../src/core/things/Semester';
|
||||
import {SCSetting, SCSettingWithoutReferences} from '../src/core/things/Setting';
|
||||
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/core/things/SportCourse';
|
||||
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/core/things/StudyModule';
|
||||
import {SCTicket, SCTicketWithoutReferences} from '../src/core/things/Ticket';
|
||||
import {SCToDo, SCToDoWithoutReferences} from '../src/core/things/ToDo';
|
||||
import {SCTour, SCTourWithoutReferences} from '../src/core/things/Tour';
|
||||
import {SCVideo, SCVideoWithoutReferences} from '../src/core/things/Video';
|
||||
import {SCThing, SCThingWithoutReferences} from '../src/things/abstract/thing';
|
||||
import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/things/academic-event';
|
||||
import {SCArticle, SCArticleWithoutReferences} from '../src/things/article';
|
||||
import {SCBook, SCBookWithoutReferences} from '../src/things/book';
|
||||
import {SCBuilding, SCBuildingWithoutReferences} from '../src/things/building';
|
||||
import {SCCatalog, SCCatalogWithoutReferences} from '../src/things/catalog';
|
||||
import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/things/course-of-studies';
|
||||
import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/things/date-series';
|
||||
import {SCDiff, SCDiffWithoutReferences} from '../src/things/diff';
|
||||
import {SCDish, SCDishWithoutReferences} from '../src/things/dish';
|
||||
import {SCFavorite, SCFavoriteWithoutReferences} from '../src/things/favorite';
|
||||
import {SCFloor, SCFloorWithoutReferences} from '../src/things/floor';
|
||||
import {SCMessage, SCMessageWithoutReferences} from '../src/things/message';
|
||||
import {SCOrganization, SCOrganizationWithoutReferences} from '../src/things/organization';
|
||||
import {SCPerson, SCPersonWithoutReferences} from '../src/things/person';
|
||||
import {SCPointOfInterest, SCPointOfInterestWithoutReferences} from '../src/things/point-of-interest';
|
||||
import {SCRoom, SCRoomWithoutReferences} from '../src/things/room';
|
||||
import {SCSemester, SCSemesterWithoutReferences} from '../src/things/semester';
|
||||
import {SCSetting, SCSettingWithoutReferences} from '../src/things/setting';
|
||||
import {SCSportCourse, SCSportCourseWithoutReferences} from '../src/things/sport-course';
|
||||
import {SCStudyModule, SCStudyModuleWithoutReferences} from '../src/things/study-module';
|
||||
import {SCTicket, SCTicketWithoutReferences} from '../src/things/ticket';
|
||||
import {SCToDo, SCToDoWithoutReferences} from '../src/things/todo';
|
||||
import {SCTour, SCTourWithoutReferences} from '../src/things/tour';
|
||||
import {SCVideo, SCVideoWithoutReferences} from '../src/things/video';
|
||||
|
||||
// tslint:disable:no-any
|
||||
// tslint:disable:completed-docs
|
||||
|
||||
/**
|
||||
* Check if E extends T
|
||||
Reference in New Issue
Block a user