Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LRS-83] Empty statement batches #95

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clj-kondo/config.edn
milt marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ npm-debug.log
package.json
*.log
/out_test
.calva/
.clj-kondo/*
!.clj-kondo/config.edn
.lsp/
4 changes: 3 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{org.clojure/clojure {:mvn/version "1.10.1"}
org.clojure/clojurescript {:mvn/version "1.10.741"}
org.clojure/core.async {:mvn/version "1.5.648"}
com.yetanalytics/xapi-schema {:mvn/version "1.3.0"
com.yetanalytics/xapi-schema {#_#_:mvn/version "1.3.0"
:git/sha "63614c73224ecb54843177ce8878a32fc9cabc50"
:git/url "https://github.com/yetanalytics/xapi-schema.git"
:exclusions [org.clojure/clojurescript]}
com.yetanalytics/gen-openapi {:mvn/version "0.0.5"}
cheshire/cheshire {:mvn/version "5.10.1"}
Expand Down
26 changes: 19 additions & 7 deletions src/test/com/yetanalytics/lrs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,25 @@
lrs/authorize
lrs/authorize-async])

(def auth-id
{:auth {:no-op {}}
:prefix ""
:scopes #{:scope/all}
:agent {"mbox" "mailto:[email protected]"}})

(deftest empty-store-test
(let [lrs (doto (mem/new-lrs {:statements-result-max 100})
(lrs/store-statements auth-id [] []))
ret-statements (get-in (lrs/get-statements lrs
auth-id
{:limit 100}
#{"en-US"})
[:statement-result :statements])]
(is (s/valid? ::xs/statements ret-statements))
(is (empty? ret-statements))))

(deftest query-test
(let [auth-id {:auth {:no-op {}}
:prefix ""
:scopes #{:scope/all}
:agent {"mbox" "mailto:[email protected]"}}
;; The serialized state shouldn't be used for this, because we're
(let [;; The serialized state shouldn't be used for this, because we're
;; changing things around.
;; The datasim data is not currently normalized, but only happens at a
;; max precision of 1 ms. That's timestamps though, looks like we have
Expand All @@ -75,8 +88,7 @@
[:statement-result :statements]))
ret-statements (get-ss {:limit 100})]
(testing (format "%s valid return statements?" (count ret-statements))
(is (s/valid? (s/every ::xs/statement)
ret-statements)))
(is (s/valid? ::xs/statements ret-statements)))
(testing "preserved?"
(is (= (dissoc (first ret-statements)
"authority"
Expand Down
Loading