Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F13522658
event-test.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
event-test.cpp
View Options
/*
* This file is part of libkazv.
* SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<catch2/catch_all.hpp>
#include
<event.hpp>
using
namespace
Kazv
;
TEST_CASE
(
"Should distinguish between state events and other events"
,
"[base][event]"
)
{
Event
state
=
R
"
(
{
"state_key": "",
"sender": "@example:example.org",
"type": "moe.kazv.mxc.custom.state.type",
"event_id": "!dummy",
"origin_server_ts": 1234,
"content": {}
}
)
"
_json
;
REQUIRE
(
state
.
isState
());
Event
nonState
=
R
"
(
{
"sender": "@example:example.org",
"type": "moe.kazv.mxc.custom.non.state.type",
"event_id": "!dummy",
"origin_server_ts": 1234,
"content": {}
}
)
"
_json
;
REQUIRE
(
!
nonState
.
isState
());
}
TEST_CASE
(
"redacted()"
,
"[base][event]"
)
{
auto
eventJson
=
R
"
(
{
"state_key": "",
"sender": "@example:example.org",
"type": "moe.kazv.mxc.custom.state.type",
"event_id": "!dummy",
"origin_server_ts": 1234,
"content": {}
}
)
"
_json
;
REQUIRE
(
!
Event
(
eventJson
).
redacted
());
eventJson
[
"unsigned"
]
=
json
::
object
({{
"redacted_because"
,
json
::
object
()}});
REQUIRE
(
Event
(
eventJson
).
redacted
());
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Dec 7, 9:12 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
699382
Default Alt Text
event-test.cpp (1 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment