Skip to content

Commit ac212d3

Browse files
committed
chore: stronger verify tests for addresses
1 parent 5a3774a commit ac212d3

File tree

16 files changed

+36
-695
lines changed

16 files changed

+36
-695
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## NEXT RELEASE
4+
5+
- Removes the unusable `carrier` param from the `verify` function on an Address
6+
37
## v3.3.0 (2022-07-18)
48

59
- Adds ability to generate shipment forms via `GenerateForm` function

EasyPost.Tests/AddressTest.cs

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,26 @@ public async Task TestCreate()
3232
Assert.AreEqual("388 Townsend St", address.street1);
3333
}
3434

35+
[TestMethod]
36+
public async Task TestCreateVerify()
37+
{
38+
_vcr.SetUpTest("create_verify");
39+
40+
Address address = await Address.Create(Fixture.IncorrectAddressToVerify);
41+
addressData.Add("verify", true);
42+
43+
Assert.IsInstanceOfType(address, typeof(Address));
44+
Assert.IsTrue(address.id.StartsWith("adr_"));
45+
Assert.AreEqual("417 MONTGOMERY ST FL 5", address.street1);
46+
}
47+
3548
[TestMethod]
3649
public async Task TestCreateVerifyStrict()
3750
{
3851
_vcr.SetUpTest("create_verify_strict");
3952

4053
Dictionary<string, object> addressData = Fixture.BasicAddress;
41-
addressData.Add("verify_strict", new List<bool>
42-
{
43-
true
44-
});
54+
addressData.Add("verify_strict", true);
4555

4656
Address address = await Address.Create(addressData);
4757

@@ -50,6 +60,21 @@ public async Task TestCreateVerifyStrict()
5060
Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1);
5161
}
5262

63+
[TestMethod]
64+
public async Task TestCreateVerifyArray()
65+
{
66+
_vcr.SetUpTest("create_verify_array");
67+
68+
Address address = await Address.Create(Fixture.IncorrectAddressToVerify);
69+
addressData.Add("verify", new List<bool>
70+
{
71+
true
72+
});
73+
74+
Assert.IsInstanceOfType(address, typeof(Address));
75+
Assert.IsTrue(address.id.StartsWith("adr_"));
76+
Assert.AreEqual("417 MONTGOMERY ST FL 5", address.street1);
77+
}
5378

5479
[TestMethod]
5580
public async Task TestRetrieve()
@@ -87,28 +112,12 @@ public async Task TestAll()
87112
}
88113
}
89114

90-
[TestMethod]
91-
public async Task TestCreateVerify()
92-
{
93-
_vcr.SetUpTest("create_verify");
94-
95-
Address address = await Address.Create(Fixture.IncorrectAddressToVerify);
96-
97-
Assert.IsInstanceOfType(address, typeof(Address));
98-
Assert.IsTrue(address.id.StartsWith("adr_"));
99-
Assert.AreEqual("417 MONTGOMERY ST FL 5", address.street1);
100-
}
101-
102115
[TestMethod]
103116
public async Task TestCreateAndVerify()
104117
{
105118
_vcr.SetUpTest("create_and_verify");
106119

107120
Dictionary<string, object> addressData = Fixture.BasicAddress;
108-
addressData.Add("verify_strict", new List<bool>
109-
{
110-
true
111-
});
112121

113122
Address address = await Address.CreateAndVerify(addressData);
114123

@@ -122,7 +131,6 @@ public async Task TestVerify()
122131
{
123132
_vcr.SetUpTest("verify");
124133

125-
126134
Address address = await CreateBasicAddress();
127135

128136
await address.Verify();

EasyPost.Tests/Fixture.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ public static Dictionary<string, object> IncorrectAddressToVerify
7979
{
8080
return new Dictionary<string, object>
8181
{
82-
{
83-
"verify", new List<bool>
84-
{
85-
true
86-
}
87-
},
8882
{
8983
"street1", "417 montgomery street"
9084
},

EasyPost.Tests/cassettes/net462/address/create_and_verify.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

EasyPost.Tests/cassettes/net462/address/create_verify.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

EasyPost.Tests/cassettes/net462/address/create_verify_strict.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

EasyPost.Tests/cassettes/net50/address/create_and_verify.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

EasyPost.Tests/cassettes/net50/address/create_verify.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)