mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
feat: tests
This commit is contained in:
33
packages/core/test/dummy/building.ts
Normal file
33
packages/core/test/dummy/building.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import {SCBuildingWithoutReferences, SCThingType} from '../../src/index.js';
|
||||
|
||||
export const building: SCBuildingWithoutReferences = {
|
||||
address: {
|
||||
addressCountry: 'base-address.addressCountry',
|
||||
addressLocality: 'base-address.addressLocality',
|
||||
postalCode: 'base-address.postalCode',
|
||||
streetAddress: 'base-address.streetAddress',
|
||||
},
|
||||
categories: ['office', 'education'],
|
||||
floors: ['base-floor0', 'base-floor1'],
|
||||
geo: {
|
||||
point: {
|
||||
coordinates: [12, 13],
|
||||
type: 'Point',
|
||||
},
|
||||
},
|
||||
name: 'base-space-name',
|
||||
translations: {
|
||||
de: {
|
||||
address: {
|
||||
addressCountry: 'de-address.addressCountry',
|
||||
addressLocality: 'de-address.addressLocality',
|
||||
postalCode: 'de-address.postalCode',
|
||||
streetAddress: 'de-address.streetAddress',
|
||||
},
|
||||
floors: ['de-floor0', 'de-floor1'],
|
||||
name: 'de-space-name',
|
||||
},
|
||||
},
|
||||
type: SCThingType.Building,
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217140',
|
||||
};
|
||||
9
packages/core/test/dummy/bulk-response.ts
Normal file
9
packages/core/test/dummy/bulk-response.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import {SCBulkResponse, SCThingType} from '../../src/index.js';
|
||||
|
||||
export const bulkResponse: SCBulkResponse = {
|
||||
expiration: '2009-06-30T18:30:00+02:00 ',
|
||||
source: 'bar',
|
||||
state: 'done',
|
||||
type: SCThingType.Dish,
|
||||
uid: 'foo',
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
import {SCSearchResponse} from '../../src/index.js';
|
||||
import {dishWithTranslation} from './dish-with-translation.js';
|
||||
|
||||
export const dishWithTranslationSearchResponse: SCSearchResponse = {
|
||||
data: [dishWithTranslation],
|
||||
facets: [
|
||||
{
|
||||
buckets: [
|
||||
{
|
||||
count: 1,
|
||||
key: 'key',
|
||||
},
|
||||
],
|
||||
field: 'field',
|
||||
},
|
||||
],
|
||||
pagination: {
|
||||
count: 1,
|
||||
offset: 0,
|
||||
total: 1,
|
||||
},
|
||||
stats: {
|
||||
time: 1,
|
||||
},
|
||||
};
|
||||
17
packages/core/test/dummy/dish-with-translation.ts
Normal file
17
packages/core/test/dummy/dish-with-translation.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {SCDish, SCThingOriginType, SCThingType} from '../../src/index.js';
|
||||
|
||||
export const dishWithTranslation: SCDish = {
|
||||
categories: ['appetizer'],
|
||||
name: 'foo',
|
||||
origin: {
|
||||
created: '',
|
||||
type: SCThingOriginType.User,
|
||||
},
|
||||
translations: {
|
||||
de: {
|
||||
name: 'Foo',
|
||||
},
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: 'bar',
|
||||
};
|
||||
35
packages/core/test/dummy/dish.ts
Normal file
35
packages/core/test/dummy/dish.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import {SCDish, SCThingOriginType, SCThingType} from '../../src/index.js';
|
||||
import {building} from './building.js';
|
||||
|
||||
export const dish: SCDish = {
|
||||
categories: ['main dish', 'dessert'],
|
||||
characteristics: [{name: 'base-characteristic0'}, {name: 'base-characteristic1'}],
|
||||
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',
|
||||
},
|
||||
},
|
||||
],
|
||||
origin: {
|
||||
indexed: '1970-01-01T00:00:00.000Z',
|
||||
name: 'dish-connector',
|
||||
type: SCThingOriginType.Remote,
|
||||
},
|
||||
translations: {
|
||||
de: {
|
||||
characteristics: [{name: 'de-characteristic0'}, {name: 'de-characteristic1'}],
|
||||
name: 'de-dish-name',
|
||||
},
|
||||
},
|
||||
type: SCThingType.Dish,
|
||||
uid: '540862f3-ea30-5b8f-8678-56b4dc217140',
|
||||
};
|
||||
13
packages/core/test/dummy/not-a-dish.ts
Normal file
13
packages/core/test/dummy/not-a-dish.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {SCThingOriginType} from '../../src/index.js';
|
||||
import {SCDish} from '../../lib/index.js';
|
||||
|
||||
export const notADish: Omit<SCDish, 'type'> & {type: 'foobar'} = {
|
||||
categories: ['appetizer'],
|
||||
name: 'foo',
|
||||
origin: {
|
||||
created: '',
|
||||
type: SCThingOriginType.User,
|
||||
},
|
||||
type: 'foobar',
|
||||
uid: 'bar',
|
||||
};
|
||||
18
packages/core/test/dummy/setting.ts
Normal file
18
packages/core/test/dummy/setting.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {SCSetting, SCSettingInputType, SCThingOriginType, SCThingType} from '../../src/index.js';
|
||||
|
||||
export const setting: SCSetting = {
|
||||
categories: ['profile'],
|
||||
defaultValue: 'student',
|
||||
description: 'base-description',
|
||||
inputType: SCSettingInputType.SingleChoice,
|
||||
name: 'group',
|
||||
order: 1,
|
||||
origin: {
|
||||
indexed: '2018-11-11T14:30:00Z',
|
||||
name: 'Dummy',
|
||||
type: SCThingOriginType.Remote,
|
||||
},
|
||||
type: SCThingType.Setting,
|
||||
uid: '2c97aa36-4aa2-43de-bc5d-a2b2cb3a530e',
|
||||
values: ['student', 'employee', true, 42],
|
||||
};
|
||||
Reference in New Issue
Block a user