Skip to content

Commit

Permalink
chore(td-tools/tests): update tm @context URI
Browse files Browse the repository at this point in the history
  • Loading branch information
relu91 committed Sep 15, 2022
1 parent 73778e4 commit e3b194c
Show file tree
Hide file tree
Showing 30 changed files with 65 additions and 65 deletions.
40 changes: 20 additions & 20 deletions packages/td-tools/test/ThingModelHelperTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ThingModelHelperTest {

@test "should correctly validate tm schema with ThingModel in @type"() {
const model = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
title: "thingTest",
"@type": "tm:ThingModel",
properties: {
Expand All @@ -46,7 +46,7 @@ class ThingModelHelperTest {
@test "should correctly return the right links"() {
const thing = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
links: [
{
Expand All @@ -72,7 +72,7 @@ class ThingModelHelperTest {
@test "should correctly validate tm schema with ThingModel in @type array "() {
const model = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": ["random:Type", "tm:ThingModel"],
properties: {
myProp: {
Expand All @@ -91,7 +91,7 @@ class ThingModelHelperTest {
@test "should reject schema on validation because missing ThingModel definition"() {
const model = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "random:Type",
links: [
{
Expand All @@ -115,7 +115,7 @@ class ThingModelHelperTest {
@test "should correctly return the model version"() {
let thing: ThingModel = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": ["random:Type", "tm:ThingModel"],
version: { model: "0.0.1" }, // TODO: check is version is valid
};
Expand All @@ -126,7 +126,7 @@ class ThingModelHelperTest {

thing = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": ["random:Type", "tm:ThingModel"],
version: {},
};
Expand All @@ -136,7 +136,7 @@ class ThingModelHelperTest {

thing = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": ["random:Type", "tm:ThingModel"],
};

Expand All @@ -162,7 +162,7 @@ class ThingModelHelperTest {
const model = JSON.parse(modelJSON.toString()) as ThingModel;
const finalModel = {
"@type": "tm:ThingModel",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
title: "Smart Lamp Control with Dimming",
links: [
{
Expand All @@ -187,7 +187,7 @@ class ThingModelHelperTest {
extends: [
{
"@type": "tm:ThingModel",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
actions: {
toggle: { type: "boolean" },
},
Expand Down Expand Up @@ -216,7 +216,7 @@ class ThingModelHelperTest {
const thingModel: ThingModel = {
title: "thingTest",
"@type": ["random:Type", "tm:ThingModel"],
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
properties: {
timestamp1: {
"tm:ref": "file://./test/thing-model/tmodels/OnOff.jsonld#/properties/timestamp",
Expand All @@ -228,7 +228,7 @@ class ThingModelHelperTest {
const finalThingModel = {
title: "thingTest",
"@type": ["random:Type", "tm:ThingModel"],
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
properties: {
timestamp1: {
type: "number",
Expand All @@ -254,7 +254,7 @@ class ThingModelHelperTest {
@test async "should correctly import an action and add a field to the action"() {
const thingModel: ThingModel = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": ["random:Type", "tm:ThingModel"],
actions: {
toggle1: {
Expand All @@ -274,7 +274,7 @@ class ThingModelHelperTest {

const finalThingModel = {
title: "thingTest",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": ["random:Type", "tm:ThingModel"],
actions: {
toggle1: {
Expand All @@ -297,7 +297,7 @@ class ThingModelHelperTest {

@test async "should correctly fill placeholders"() {
const thing = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
title: "Thermostate No. {{THERMOSTATE_NUMBER}}",
base: "mqtt://{{MQTT_BROKER_ADDRESS}}",
Expand All @@ -318,7 +318,7 @@ class ThingModelHelperTest {
THERMOSTATE_TEMPERATURE_OBSERVABLE: true,
};
const finalJSON = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "Thing",
title: "Thermostate No. 4",
base: "mqtt://192.168.178.72:1883",
Expand Down Expand Up @@ -349,7 +349,7 @@ class ThingModelHelperTest {

@test async "should correctly fill placeholders with composed types"() {
const thing = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
arrayField: "{{ARRAY}}",
title: "Thermostate No. 4",
Expand All @@ -360,7 +360,7 @@ class ThingModelHelperTest {
VERSION_INFO: { instance: "xyz", model: "ABC" },
};
const finalJSON = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "Thing",
title: "Thermostate No. 4",
arrayField: ["random", "random1", "random2"],
Expand All @@ -383,7 +383,7 @@ class ThingModelHelperTest {

@test async "should correctly fill placeholders with composed types in strings"() {
const thing = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
data: "data: {{ARRAY}}",
title: "Thermostate No. 4",
Expand All @@ -394,7 +394,7 @@ class ThingModelHelperTest {
VERSION_INFO: { instance: "xyz", model: "ABC" },
};
const finalJSON = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "Thing",
title: "Thermostate No. 4",
data: "data: [1,2,3]",
Expand All @@ -417,7 +417,7 @@ class ThingModelHelperTest {

@test async "should reject fill placeholders because of missing fields in map"() {
const thing = {
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
title: "Thermostate No. {{THERMOSTATE_NUMBER}}",
base: "mqtt://{{MQTT_BROKER_ADDRESS}}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Basic On/Off Thing Model",
"links": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Led Thing Model",
"@type": "tm:ThingModel",
"links": [
Expand Down Expand Up @@ -44,4 +44,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions packages/td-tools/test/thing-model/tmodels/Led.tm.jsonld
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Led Thing Model",
"version": {
Expand Down Expand Up @@ -35,4 +35,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Led Thing Model Extend",
"@type": "tm:ThingModel",
"links": [
Expand Down Expand Up @@ -56,4 +56,4 @@
"type": "boolean"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Led Thing Model Extend",
"version": {
Expand Down Expand Up @@ -42,4 +42,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Led Thing Model Extend",
"version": {
Expand Down Expand Up @@ -42,4 +42,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/td-tools/test/thing-model/tmodels/OnOff.jsonld
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Basic On/Off Thing Model",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@type": "tm:ThingModel",
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Smart Lamp Control with Dimming",
"links": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Smart Lamp Control with Dimming",
"links": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type" : "tm:ThingModel",
"title": "Smart Lamp Control",
"properties" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Smart Lamp Control",
"properties" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Smart Ventilator",
"@type": "tm:ThingModel",
"links": [
Expand Down Expand Up @@ -29,4 +29,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Smart Ventilator",
"version" : { "model" : "1.0.0" },
Expand All @@ -20,4 +20,4 @@
"properties" : {
"status" : {"type": "string", "enum": ["On", "Off", "Error"]}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Smart Ventilator Recursive",
"@type": "tm:ThingModel",
"links": [
Expand All @@ -24,4 +24,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Smart Ventilator Recursive",
"version" : { "model" : "1.0.0" },
Expand All @@ -14,4 +14,4 @@
"properties" : {
"status" : {"type": "string", "enum": ["On", "Off", "Error"]}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Smart Ventilator",
"@type": "tm:ThingModel",
"links": [
Expand Down Expand Up @@ -29,4 +29,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"@type": "tm:ThingModel",
"title": "Smart Ventilator",
"version" : { "model" : "1.0.0" },
Expand All @@ -20,4 +20,4 @@
"properties" : {
"status" : {"type": "string", "enum": ["On", "Off", "Error"]}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": ["http://www.w3.org/ns/td"],
"@context": ["https://www.w3.org/2022/wot/td/v1.1"],
"title": "Ventilator Thing Model",
"@type": "tm:ThingModel",
"links": [
Expand All @@ -25,4 +25,4 @@
"maximum": 1200
}
}
}
}
Loading

0 comments on commit e3b194c

Please sign in to comment.