Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
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
elixxir
xxdk-wasm
Commits
bad0876d
Commit
bad0876d
authored
2 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
fix some tests
parent
d8b756db
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!60
Revert "Fail a test to be sure it works"
,
!36
project/DM
,
!32
Admin Commands
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexedDb/channels/implementation_test.go
+7
-23
7 additions, 23 deletions
indexedDb/channels/implementation_test.go
with
7 additions
and
23 deletions
indexedDb/channels/implementation_test.go
+
7
−
23
View file @
bad0876d
...
...
@@ -368,7 +368,7 @@ func Test_wasmModel_deleteMsgByChannel(t *testing.T) {
thisChannel
=
keepChannel
}
testMsgId
:=
message
.
DeriveChannelMessageID
(
&
id
.
ID
{
1
},
0
,
[]
byte
(
testStr
))
testMsgId
:=
message
.
DeriveChannelMessageID
(
&
id
.
ID
{
byte
(
i
)
},
0
,
[]
byte
(
testStr
))
eventModel
.
ReceiveMessage
(
thisChannel
,
testMsgId
,
testStr
,
testStr
,
[]
byte
{
8
,
6
,
7
,
5
},
0
,
0
,
netTime
.
Now
(),
time
.
Second
,
rounds
.
Round
{
ID
:
id
.
Round
(
0
)},
0
,
channels
.
Sent
,
false
)
...
...
@@ -451,17 +451,10 @@ func TestWasmModel_receiveHelper_UniqueIndex(t *testing.T) {
t
.
Fatal
(
err
)
}
// The duplicate entry
won't fail, but it just silently shouldn't happen
// The duplicate entry
should fail
_
,
err
=
eventModel
.
receiveHelper
(
testMsg
,
false
)
if
err
!=
nil
{
t
.
Fatalf
(
"%+v"
,
err
)
}
results
,
err
:=
indexedDb
.
Dump
(
eventModel
.
db
,
messageStoreName
)
if
err
!=
nil
{
t
.
Fatalf
(
"%+v"
,
err
)
}
if
len
(
results
)
!=
1
{
t
.
Fatalf
(
"Expected only a single message, got %d"
,
len
(
results
))
if
err
==
nil
{
t
.
Fatalf
(
"Expected duplicate insert to fail!"
)
}
// Now insert a message with a different message ID from the first
...
...
@@ -475,22 +468,13 @@ func TestWasmModel_receiveHelper_UniqueIndex(t *testing.T) {
}
// Except this time, we update the second entry to have the same
// message ID as the first
// message ID as the first
, which needs to fail
testMsg
.
ID
=
primaryKey
testMsg
.
MessageID
=
testMsgId
.
Bytes
()
_
,
err
=
eventModel
.
receiveHelper
(
testMsg
,
true
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// The update to duplicate message ID won't fail,
// but it just silently shouldn't happen
results
,
err
=
indexedDb
.
Dump
(
eventModel
.
db
,
messageStoreName
)
if
err
!=
nil
{
t
.
Fatalf
(
"%+v"
,
err
)
if
err
==
nil
{
t
.
Fatal
(
"Expected duplicate update to fail!"
)
}
// TODO: Convert JSON to Message, ensure Message ID fields differ
})
}
}
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