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?
:map (s/and (s/keys
:req-un [::id ::type]
:opt-un [::attributedTo ::und-mehr])
(match-type "Object"))))
:opt-un [::attributedTo ::content ::und-mehr]))))
(s/def ::id core/uri-string?)
; TODO: type can have multiple values!! Affects also the fct match-type and all specs that uses it!
@ -59,7 +58,7 @@
; #### NOTE ####
; Specialities of mastodon statuses: https://docs.joinmastodon.org/spec/activitypub/#status
(s/def ::Note (s/and ::Object
(match-type "Note")
;(match-type "Note")
(s/keys
: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]
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut]))
(deftest Note-test
(is (s/valid?
::sut/Note
{:id "https://social.bla/alyssa/status/RANDOMHASH"
:type "Note"
:content "text"})))
(deftest id-test
(is (s/valid? ::sut/id "https://social.bla/alyssa/status/RANDOMHASH")))
;(deftest Note-test
; (is (s/valid?
; ::sut/Note
; {:id "https://social.bla/alyssa/status/RANDOMHASH"
; :type "Note"
; :content "text"})))