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
020a97c5
Commit
020a97c5
authored
2 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
more uniqueness unit testing
parent
ba904f8e
No related branches found
No related tags found
1 merge request
!60
Revert "Fail a test to be sure it works"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexedDb/implementation_test.go
+29
-2
29 additions, 2 deletions
indexedDb/implementation_test.go
with
29 additions
and
2 deletions
indexedDb/implementation_test.go
+
29
−
2
View file @
020a97c5
...
@@ -292,8 +292,8 @@ func TestWasmModel_receiveHelper_UniqueIndex(t *testing.T) {
...
@@ -292,8 +292,8 @@ func TestWasmModel_receiveHelper_UniqueIndex(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
// The duplicate entry won't fail, it just silently shouldn't happen
// The duplicate entry won't fail,
but
it just silently shouldn't happen
_
,
err
=
eventModel
.
receiveHelper
(
testMsg
,
tru
e
)
_
,
err
=
eventModel
.
receiveHelper
(
testMsg
,
fals
e
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"%+v"
,
err
)
t
.
Fatalf
(
"%+v"
,
err
)
}
}
...
@@ -304,4 +304,31 @@ func TestWasmModel_receiveHelper_UniqueIndex(t *testing.T) {
...
@@ -304,4 +304,31 @@ func TestWasmModel_receiveHelper_UniqueIndex(t *testing.T) {
if
len
(
results
)
!=
1
{
if
len
(
results
)
!=
1
{
t
.
Fatalf
(
"Expected only a single message, got %d"
,
len
(
results
))
t
.
Fatalf
(
"Expected only a single message, got %d"
,
len
(
results
))
}
}
// Now insert a message with a different message ID from the first
testMsgId2
:=
channel
.
MakeMessageID
([]
byte
(
testString
),
&
id
.
ID
{
2
})
testMsg
=
buildMessage
([]
byte
(
testString
),
testMsgId2
.
Bytes
(),
nil
,
testString
,
testString
,
[]
byte
{
8
,
6
,
7
,
5
},
0
,
netTime
.
Now
(),
time
.
Second
,
0
,
0
,
channels
.
Sent
)
primaryKey
,
err
:=
eventModel
.
receiveHelper
(
testMsg
,
false
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
// Except this time, we update the second entry to have the same
// message ID as the first
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
=
eventModel
.
dump
(
messageStoreName
)
if
err
!=
nil
{
t
.
Fatalf
(
"%+v"
,
err
)
}
// 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