Skip to content

Commit

Permalink
Added failing test for serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Jan 20, 2024
1 parent a9e5559 commit b289b91
Show file tree
Hide file tree
Showing 2 changed files with 2,587 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Tests/EOSIOTests/ABICodingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,25 @@ final class ABICodableTests: XCTestCase {
let json = try! JSONEncoder().encode(decoded, asType: "addproofown", using: abi)
XCTAssertEqual(json.utf8String.normalizedJSON, actionJSON.normalizedJSON)
}

func testUnlinkAuth() {
let abi = try! ABI(json: loadTestResource("eosio.json"))
let json = """
{
"account": "test.gm",
"code": "rams.eos",
"type": "mint",
"authorized_by": "test.gm"
}
"""
let object = try! JSONDecoder().decode("unlinkauth", from: json.utf8Data, using: abi)
let recoded = try! JSONEncoder().encode(object, asType: "unlinkauth", using: abi)
XCTAssertEqual(json.normalizedJSON, recoded.utf8String.normalizedJSON)

let data = try! ABIEncoder().encode(object, asType: "unlinkauth", using: abi)

let object2 = try! ABIDecoder().decode("unlinkauth", from: data, using: abi)
let recoded2 = try! JSONEncoder().encode(object2, asType: "unlinkauth", using: abi)
XCTAssertEqual(json.normalizedJSON, recoded2.utf8String.normalizedJSON)
}
}
Loading

0 comments on commit b289b91

Please sign in to comment.