Skip to content

Commit

Permalink
fixup! feat!: rework TD @context handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed May 18, 2024
1 parent ab8b4f8 commit 6db1fc4
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions test/core/context_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,31 @@ void main() {
throwsA(isA<ValidationException>()),
);
});
});

test("be supported when including both the TD 1.0 and 1.1 URL", () {
const tdVersion11ContextUrl = "https://www.w3.org/2022/wot/td/v1.1";
test("be supported when including both the TD 1.0 and 1.1 URL", () {
const tdVersion11ContextUrl = "https://www.w3.org/2022/wot/td/v1.1";

final tdVersion10ContextEntry =
SingleContextEntry.fromString("https://www.w3.org/2019/wot/td/v1");

final tdVersion10ContextEntry =
SingleContextEntry.fromString("https://www.w3.org/2019/wot/td/v1");
final tdVersion11ContextEntry =
SingleContextEntry.fromString(tdVersion11ContextUrl);

final tdVersion11ContextEntry =
SingleContextEntry.fromString(tdVersion11ContextUrl);
expect(
Context([tdVersion10ContextEntry, tdVersion11ContextEntry])
.prefixMapping
.defaultPrefixValue,
tdVersion11ContextUrl,
);
});
});

expect(
Context([tdVersion10ContextEntry, tdVersion11ContextEntry])
.prefixMapping
.defaultPrefixValue,
tdVersion11ContextUrl,
);
group("SingleContextEntry should", () {
test("only be valid when created from a valid URI", () {
expect(
() => SingleContextEntry.fromString("::foobar::"),
throwsA(isA<ValidationException>()),
);
});
});
}

0 comments on commit 6db1fc4

Please sign in to comment.