-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move serializer tests to integration target
- Loading branch information
1 parent
13c5a77
commit 885d109
Showing
9 changed files
with
63 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
|
||
import Foundation | ||
|
||
import XCTest | ||
@testable import WalletConnectKMS | ||
@testable import WalletConnect | ||
@testable import TestingUtils | ||
|
||
final class SerializerTests: XCTestCase { | ||
var serializer: Serializer! | ||
var codec: MockedCodec! | ||
override func setUp() { | ||
codec = MockedCodec() | ||
self.serializer = Serializer(kms: KeyManagementService(keychain: KeychainStorageMock()), codec: codec) | ||
} | ||
|
||
override func tearDown() { | ||
serializer = nil | ||
} | ||
|
||
func testSerialize() { | ||
codec.encryptionPayload = EncryptionPayload(iv: SerializerTestData.iv, | ||
publicKey: SerializerTestData.publicKey, | ||
mac: SerializerTestData.mac, | ||
cipherText: SerializerTestData.cipherText) | ||
let serializedMessage = try! serializer.encrypt(json: SerializerTestData.pairingApproveJSON, agreementKeys: SerializerTestData.emptyAgreementSecret) | ||
let serializedMessageSample = SerializerTestData.serializedMessage | ||
XCTAssertEqual(serializedMessage, serializedMessageSample) | ||
} | ||
|
||
func testDeserialize() { | ||
let serializedMessageSample = SerializerTestData.serializedMessage | ||
codec.decodedJson = SerializerTestData.pairingApproveJSON | ||
let deserializedJSONRPC: WCRequest = try! serializer.deserialize(message: serializedMessageSample, symmetricKey: Data(hex: "")) | ||
XCTAssertEqual(deserializedJSONRPC.params, SerializerTestData.pairingApproveJSONRPCRequest.params) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.