Added id-test

This commit is contained in:
Clemens 2023-07-18 08:30:09 +02:00
parent d90a5ca1ca
commit a110c73978
3 changed files with 23 additions and 9 deletions

View file

@ -30,8 +30,7 @@
:uri core/uri-string? :uri core/uri-string?
:map (s/and (s/keys :map (s/and (s/keys
:req-un [::id ::type] :req-un [::id ::type]
:opt-un [::attributedTo ::und-mehr]) :opt-un [::attributedTo ::content ::und-mehr]))))
(match-type "Object"))))
(s/def ::id core/uri-string?) (s/def ::id core/uri-string?)
; TODO: type can have multiple values!! Affects also the fct match-type and all specs that uses it! ; TODO: type can have multiple values!! Affects also the fct match-type and all specs that uses it!
@ -59,7 +58,7 @@
; #### NOTE #### ; #### NOTE ####
; Specialities of mastodon statuses: https://docs.joinmastodon.org/spec/activitypub/#status ; Specialities of mastodon statuses: https://docs.joinmastodon.org/spec/activitypub/#status
(s/def ::Note (s/and ::Object (s/def ::Note (s/and ::Object
(match-type "Note") ;(match-type "Note")
(s/keys (s/keys
:opt-un [::likes]))) :opt-un [::likes])))

View file

@ -0,0 +1,7 @@
(ns org.domaindrivenarchitecture.activity-pub-poc.xsd
(:require [clojure.spec.alpha :as s]))
; http://www.datypic.com/sc/xsd/t-xsd_anyURI.html
; TODO: Find out correct definition!
(defn anyUri? [input]
false)

View file

@ -5,9 +5,17 @@
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut])) [org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut]))
(deftest Note-test (deftest id-test
(is (s/valid? (is (s/valid? ::sut/id "https://social.bla/alyssa/status/RANDOMHASH")))
::sut/Note
{:id "https://social.bla/alyssa/status/RANDOMHASH"
:type "Note"
:content "text"})))
;(deftest Note-test
; (is (s/valid?
; ::sut/Note
; {:id "https://social.bla/alyssa/status/RANDOMHASH"
; :type "Note"
; :content "text"})))