Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
document-storage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wandelwerk-Software
libraries
document-storage
Commits
1bc9f22c
Commit
1bc9f22c
authored
4 years ago
by
Bruno Burke
Browse files
Options
Downloads
Patches
Plain Diff
add test with fixture
parent
1001773c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#34766
passed
4 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/document_storage/core_test.clj
+37
-4
37 additions, 4 deletions
test/document_storage/core_test.clj
with
37 additions
and
4 deletions
test/document_storage/core_test.clj
+
37
−
4
View file @
1bc9f22c
(
ns
document-storage.core-test
(
:require
[
clojure.test
:refer
:all
]
[
document-storage.core
:refer
:all
]))
[
document-storage.core
:as
ds
]
[
clojure.java.io
:as
io
]
[
fipp.edn
:refer
[
pprint
]
:rename
{
pprint
fipp
}]))
(
deftest
a-test
(
testing
"I pass."
(
is
(
=
1
1
))))
(
defn
create-storage
[
directory
]
(
let
[
config-file
(
str
directory
"/"
"config.edn"
)
config
{
:repositories
{
:testrepo
{}}}]
(
io/make-parents
config-file
)
(
spit
config-file
(
with-out-str
(
fipp
config
)))))
(
defn
delete-folder
[
f1
&
[
silently
]]
(
when
(
.isDirectory
(
io/file
f1
))
(
doseq
[
f2
(
.listFiles
(
io/file
f1
))]
(
delete-folder
f2
silently
)))
(
io/delete-file
f1
silently
))
(
defn
destroy-storage
[
directory
]
(
delete-folder
directory
))
(
defn
storage-fixture
[
f
]
(
create-storage
"teststorage"
)
(
ds/init-storage
"teststorage"
)
(
f
)
(
destroy-storage
"teststorage"
))
(
use-fixtures
:once
storage-fixture
)
(
deftest
simple-test
(
testing
"save basic structure and load it"
(
let
[
structure
{
:a
5
:c
[
1
2
3
4
99
5
-4
]}
id
"simple-test1"
repo
:testrepo
]
(
ds/save-document
id
structure
:repository
repo
)
(
is
(
=
structure
(
ds/load-document
id
:repository
repo
))))))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment