Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
b6646533
Unverified
Commit
b6646533
authored
Sep 04, 2024
by
onee-only
Committed by
GitHub
Sep 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test for searching memos by tags (#3876)
parent
95939ebc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
memo_test.go
test/store/memo_test.go
+38
-0
No files found.
test/store/memo_test.go
View file @
b6646533
...
...
@@ -7,6 +7,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/usememos/memos/store"
storepb
"github.com/usememos/memos/proto/gen/store"
)
func
TestMemoStore
(
t
*
testing
.
T
)
{
...
...
@@ -62,6 +64,42 @@ func TestMemoStore(t *testing.T) {
ts
.
Close
()
}
func
TestMemoListByTags
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ts
:=
NewTestingStore
(
ctx
,
t
)
user
,
err
:=
createTestingHostUser
(
ctx
,
ts
)
require
.
NoError
(
t
,
err
)
memoCreate
:=
&
store
.
Memo
{
UID
:
"test-resource-name"
,
CreatorID
:
user
.
ID
,
Content
:
"test_content"
,
Visibility
:
store
.
Public
,
Payload
:
&
storepb
.
MemoPayload
{
Property
:
&
storepb
.
MemoPayload_Property
{
Tags
:
[]
string
{
"test_tag"
},
},
},
}
memo
,
err
:=
ts
.
CreateMemo
(
ctx
,
memoCreate
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
memoCreate
.
Content
,
memo
.
Content
)
memo
,
err
=
ts
.
GetMemo
(
ctx
,
&
store
.
FindMemo
{
ID
:
&
memo
.
ID
,
})
require
.
NoError
(
t
,
err
)
require
.
NotNil
(
t
,
memo
)
memoList
,
err
:=
ts
.
ListMemos
(
ctx
,
&
store
.
FindMemo
{
PayloadFind
:
&
store
.
FindMemoPayload
{
TagSearch
:
[]
string
{
"test_tag"
},
},
})
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
1
,
len
(
memoList
))
require
.
Equal
(
t
,
memo
,
memoList
[
0
])
ts
.
Close
()
}
func
TestDeleteMemoStore
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ts
:=
NewTestingStore
(
ctx
,
t
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment