|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" |
| 3 | + xmlns:map="http://www.w3.org/2005/xpath-functions/map" |
| 4 | + xmlns:array="http://www.w3.org/2005/xpath-functions/array" |
| 5 | + xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| 6 | + xmlns:dts="https://distributed-text-services.github.io/specifications/" |
| 7 | + xmlns:t="http://www.tei-c.org/ns/1.0" stylesheet="path-parameters.xsl" run-as="external"> |
| 8 | + |
| 9 | + <x:variable name="x:saxon-config" href="../../test/saxon.xml"/> |
| 10 | + |
| 11 | + <x:param name="encode" select="encode-for-uri#1"/> |
| 12 | + |
| 13 | + <x:scenario label="navigation uri; empty parameters map"> |
| 14 | + <x:call function="dts:navigation-uri"> |
| 15 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 16 | + <x:param name="parameters" select="map { }"/> |
| 17 | + </x:call> |
| 18 | + <x:expect label="result" |
| 19 | + select="matches($x:result, '^https://example.org/api/dts/navigation/+')" pending="todo" |
| 20 | + /> |
| 21 | + </x:scenario> |
| 22 | + |
| 23 | + <x:scenario label="navigation uri; silly parameters map"> |
| 24 | + <x:call function="dts:navigation-uri"> |
| 25 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 26 | + <x:param name="parameters" select="map { 'tree': 'av', 'c': 'cv'}"/> |
| 27 | + </x:call> |
| 28 | + <x:expect label="result" select="xs:anyURI('https://example.org/api/dts/navigation//av')"/> |
| 29 | + </x:scenario> |
| 30 | + |
| 31 | + <x:scenario label="navigation uri; silly parameters map, reversed order"> |
| 32 | + <x:call function="dts:navigation-uri"> |
| 33 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 34 | + <x:param name="parameters" select="map { 'c': 'cv', 'tree': 'av' }"/> |
| 35 | + </x:call> |
| 36 | + <x:expect label="result" select="xs:anyURI('https://example.org/api/dts/navigation//av')"/> |
| 37 | + </x:scenario> |
| 38 | + |
| 39 | + <x:scenario label="navigation uri template; silly parameters"> |
| 40 | + <x:call function="dts:navigation-uri-template-on-resource"> |
| 41 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 42 | + <x:param name="parameters" select="map { 'c': 'cv', 'a': 'av' }"/> |
| 43 | + </x:call> |
| 44 | + <x:expect label="result" |
| 45 | + select="xs:anyURI('https://example.org/api/dts/navigation//{ref,down,start,end,tree,page}')" |
| 46 | + /> |
| 47 | + </x:scenario> |
| 48 | + |
| 49 | + <x:scenario label="navigation uri template; silly parameters and resource"> |
| 50 | + <x:call function="dts:navigation-uri-template-on-resource"> |
| 51 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 52 | + <x:param name="parameters" |
| 53 | + select="map { 'c': 'cv', 'a': 'av', 'resource': 'http://abgedre.ht/zuckt' }"/> |
| 54 | + </x:call> |
| 55 | + <x:expect label="result" |
| 56 | + select="xs:anyURI('https://example.org/api/dts/navigation/http%3A%2F%2Fabgedre.ht%2Fzuckt/{ref,down,start,end,tree,page}')" |
| 57 | + /> |
| 58 | + </x:scenario> |
| 59 | + |
| 60 | + <x:scenario label="collection uri template; silly parameters and resource"> |
| 61 | + <x:call function="dts:collection-uri-template-on-resource"> |
| 62 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 63 | + <x:param name="parameters" |
| 64 | + select="map { 'c': 'cv', 'a': 'av', 'resource': 'http://abgedre.ht/zuckt' }"/> |
| 65 | + </x:call> |
| 66 | + <x:expect label="result" |
| 67 | + select="xs:anyURI('https://example.org/api/dts/collection/http%3A%2F%2Fabgedre.ht%2Fzuckt/{page,nav}')" |
| 68 | + /> |
| 69 | + </x:scenario> |
| 70 | + |
| 71 | + <x:scenario label="document uri template; silly parameters and resource"> |
| 72 | + <x:call function="dts:document-uri-template-on-resource"> |
| 73 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 74 | + <x:param name="parameters" |
| 75 | + select="map { 'c': 'cv', 'a': 'av', 'resource': 'http://abgedre.ht/zuckt' }"/> |
| 76 | + </x:call> |
| 77 | + <x:expect label="result" |
| 78 | + select="xs:anyURI('https://example.org/api/dts/document/http%3A%2F%2Fabgedre.ht%2Fzuckt/{ref,start,end,tree,mediaType}')" |
| 79 | + /> |
| 80 | + </x:scenario> |
| 81 | + |
| 82 | + <x:scenario label="templates for navigation entpoint"> |
| 83 | + <x:call function="dts:uri-template-map-entries"> |
| 84 | + <x:param name="resource" href="../../test/matt.xml"/> |
| 85 | + <x:param name="parameters" |
| 86 | + select="map { 'c': 'cv', 'a': 'av', 'resource': 'http://abgedre.ht/zuckt' }"/> |
| 87 | + </x:call> |
| 88 | + <x:expect label="has collection uri template" |
| 89 | + test="$x:result[map:contains(., 'collection')] => exists()"/> |
| 90 | + <x:expect label="has document uri template" |
| 91 | + test="$x:result[map:contains(., 'document')] => exists()"/> |
| 92 | + <x:expect label="has navigation uri template" |
| 93 | + test="$x:result[map:contains(., 'navigation')] => exists()"/> |
| 94 | + <x:expect label="does not have unknown uri template" |
| 95 | + test="$x:result[map:contains(., 'unknown')] => exists() => not()"/> |
| 96 | + </x:scenario> |
| 97 | + |
| 98 | +</x:description> |
0 commit comments