Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
mobile
iOS
Elixxir dApps SDK Swift
Commits
191bcdb3
Commit
191bcdb3
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Make MessageService.metadata optional
parent
a96e4948
No related branches found
No related tags found
2 merge requests
!141
Make MessageService.metadata optional
,
!102
Release 1.0.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/XXClient/Models/MessageService.swift
+2
-2
2 additions, 2 deletions
Sources/XXClient/Models/MessageService.swift
Tests/XXClientTests/Models/MessageServiceTests.swift
+25
-0
25 additions, 0 deletions
Tests/XXClientTests/Models/MessageServiceTests.swift
with
27 additions
and
2 deletions
Sources/XXClient/Models/MessageService.swift
+
2
−
2
View file @
191bcdb3
...
...
@@ -4,7 +4,7 @@ public struct MessageService: Equatable {
public
init
(
identifier
:
Data
,
tag
:
String
,
metadata
:
Data
metadata
:
Data
?
)
{
self
.
identifier
=
identifier
self
.
tag
=
tag
...
...
@@ -13,7 +13,7 @@ public struct MessageService: Equatable {
public
var
identifier
:
Data
public
var
tag
:
String
public
var
metadata
:
Data
public
var
metadata
:
Data
?
}
extension
MessageService
:
Codable
{
...
...
This diff is collapsed.
Click to expand it.
Tests/XXClientTests/Models/MessageServiceTests.swift
+
25
−
0
View file @
191bcdb3
...
...
@@ -29,6 +29,31 @@ final class MessageServiceTests: XCTestCase {
XCTAssertNoDifference
(
decodedModel
,
model
)
}
func
testCodingWithoutMetadata
()
throws
{
let
identifierB64
=
"AQID"
let
tag
=
"TestTag 2"
let
jsonString
=
"""
{
"
Identifier
": "
\(
identifierB64
)
",
"
Tag
": "
\(
tag
)
",
"
Metadata
": null
}
"""
let
jsonData
=
jsonString
.
data
(
using
:
.
utf8
)
!
let
model
=
try
MessageService
.
decode
(
jsonData
)
XCTAssertNoDifference
(
model
,
MessageService
(
identifier
:
Data
(
base64Encoded
:
identifierB64
)
!
,
tag
:
tag
,
metadata
:
nil
))
let
encodedModel
=
try
model
.
encode
()
let
decodedModel
=
try
MessageService
.
decode
(
encodedModel
)
XCTAssertNoDifference
(
decodedModel
,
model
)
}
func
testCodingArray
()
throws
{
let
models
=
[
MessageService
(
...
...
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