Skip to content

Commit 261ab36

Browse files
chore: EIP4361 tests renamed to match the code style requirements
1 parent e616a03 commit 261ab36

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Tests/web3swiftTests/localTests/EIP4361Test.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Web3Core
1313
class EIP4361Test: XCTestCase {
1414

1515
/// Parsing Sign in with Ethereum message
16-
func test_EIP4361Parsing() {
16+
func testEIP4361Parsing() {
1717
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
1818
guard let siweMessage = EIP4361(rawSiweMessage) else {
1919
XCTFail("Failed to parse SIWE message.")
@@ -38,7 +38,7 @@ class EIP4361Test: XCTestCase {
3838
XCTAssertEqual(siweMessage.description, rawSiweMessage)
3939
}
4040

41-
func test_EIP4361StaticValidationFunc() {
41+
func testEIP4361StaticValidationFunc() {
4242
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
4343

4444
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -68,7 +68,7 @@ class EIP4361Test: XCTestCase {
6868
XCTAssertEqual(siweMessage.description, rawSiweMessage)
6969
}
7070

71-
func test_validEIP4361_noOptionalFields() {
71+
func testValidEIP4361NoOptionalFields() {
7272
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z"
7373

7474
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -84,7 +84,7 @@ class EIP4361Test: XCTestCase {
8484
XCTAssertNil(validationResponse.capturedFields[.resources])
8585
}
8686

87-
func test_invalidEIP4361_missingAddress() {
87+
func testInvalidEIP4361MissingAddress() {
8888
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
8989

9090
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -96,7 +96,7 @@ class EIP4361Test: XCTestCase {
9696
XCTAssertNil(validationResponse.capturedFields[.address])
9797
}
9898

99-
func test_invalidEIP4361_missingUri() {
99+
func testInvalidEIP4361MissingUri() {
100100
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
101101

102102
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -108,7 +108,7 @@ class EIP4361Test: XCTestCase {
108108
XCTAssertNil(validationResponse.capturedFields[.uri])
109109
}
110110

111-
func test_invalidEIP4361_missingVersion() {
111+
func testInvalidEIP4361MissingVersion() {
112112
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
113113

114114
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -120,7 +120,7 @@ class EIP4361Test: XCTestCase {
120120
XCTAssertNil(validationResponse.capturedFields[.version])
121121
}
122122

123-
func test_invalidEIP4361_missingChainId() {
123+
func testInvalidEIP4361MissingChainId() {
124124
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
125125

126126
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -132,7 +132,7 @@ class EIP4361Test: XCTestCase {
132132
XCTAssertNil(validationResponse.capturedFields[.chainId])
133133
}
134134

135-
func test_invalidEIP4361_missingNonce() {
135+
func testInvalidEIP4361MissingNonce() {
136136
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
137137

138138
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -144,7 +144,7 @@ class EIP4361Test: XCTestCase {
144144
XCTAssertNil(validationResponse.capturedFields[.nonce])
145145
}
146146

147-
func test_invalidEIP4361_missingIssuedAt() {
147+
func testInvalidEIP4361MissingIssuedAt() {
148148
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
149149

150150
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -156,7 +156,7 @@ class EIP4361Test: XCTestCase {
156156
XCTAssertNil(validationResponse.capturedFields[.issuedAt])
157157
}
158158

159-
func test_invalidEIP4361_wrongVersionNumber() {
159+
func testInvalidEIP4361WrongVersionNumber() {
160160
let rawSiweMessage = "service.invalid wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 123\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z\nExpiration Time: 2021-09-29T15:25:24.234Z\nNot Before: 2021-10-28T14:25:24.123Z\nRequest ID: random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:\n- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/\n- https://example.com/my-web2-claim.json"
161161

162162
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -168,7 +168,7 @@ class EIP4361Test: XCTestCase {
168168
XCTAssertEqual(validationResponse.capturedFields[.version], "123")
169169
}
170170

171-
func test_invalidEIP4361_wrongCharInDomain() {
171+
func testInvalidEIP4361WrongCharInDomain() {
172172
let rawSiweMessage = "service.invalid/ wants you to sign in with your Ethereum account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.invalid/tos\n\nURI: https://service.invalid/login\nVersion: 1\nChain ID: 1\nNonce: 32891756\nIssued At: 2021-09-30T16:25:24.345Z"
173173

174174
let validationResponse = EIP4361.validate(rawSiweMessage)
@@ -181,7 +181,7 @@ class EIP4361Test: XCTestCase {
181181
XCTAssertEqual(validationResponse.capturedFields[.domain], "service.invalid/")
182182
}
183183

184-
func test_validEIP4361_allRequiredFieldsContainWrongData() {
184+
func testInvalidEIP4361AllRequiredFieldsContainWrongData() {
185185
let rawSiweMessage = "service.invalid/path wants you to sign in with your Ethereum account:\nnot-a-hex-1234567890qwertyuiop1234567890qwertyuiop\n\nTHESTATEMENT123102938102938: aURIisSupposedToBeHEre\n\nURI: ANOTHER_URIisSupposedToBeHEre\nVersion: dsfjlsdafhjalsdfjh\nChain ID: not-a-chain-id\nNonce: not a nonce\nIssued At: this-is-not-a-date\nExpiration Time: expiration-time-not-a-date\nNot Before: not-before-not-a-date\nRequest ID: %%%%random-0123456789abcdefrequest-id_STRING-._~:@!$&\'()*+,;=\nResources:noURLSreallyHERE"
186186

187187
let validationResponse = EIP4361.validate(rawSiweMessage)

0 commit comments

Comments
 (0)