Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Dec 20, 2023
1 parent bcea5f6 commit 1a7c9a2
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 30 deletions.
8 changes: 4 additions & 4 deletions profile/src/v100/factors/factor_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ mod tests {
},
"common": {
"flags": ["main"],
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Unknown Name",
Expand All @@ -219,13 +219,13 @@ mod tests {
"body": "3c986ebf9dcd9167a97036d3b2c997433e85e6cc4e4422ad89269dac7bfea240"
},
"common": {
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"flags": ["main"],
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Orange, scratched",
Expand Down
4 changes: 2 additions & 2 deletions profile/src/v100/factors/factor_source_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ mod tests {
&model,
r#"
{
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"flags": ["main"],
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
}
"#,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ mod tests {
r#"
{
"common": {
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"flags": ["main"],
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"mnemonicWordCount": 24,
Expand Down
8 changes: 4 additions & 4 deletions profile/src/v100/factors/factor_sources/factor_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ mod tests {
},
"common": {
"flags": ["main"],
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Unknown Name",
Expand All @@ -148,13 +148,13 @@ mod tests {
"body": "3c986ebf9dcd9167a97036d3b2c997433e85e6cc4e4422ad89269dac7bfea240"
},
"common": {
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"flags": ["main"],
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Orange, scratched",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ mod tests {
"body": "3c986ebf9dcd9167a97036d3b2c997433e85e6cc4e4422ad89269dac7bfea240"
},
"common": {
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"flags": ["main"],
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Orange, scratched",
Expand Down
2 changes: 1 addition & 1 deletion profile/src/v100/header/device_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Display for DeviceInfo {
f,
"{} | created: {} | #{}",
self.description,
&self.date.to_string(),
&self.date.date().to_string(),
self.id.to_string(),
)
}
Expand Down
8 changes: 4 additions & 4 deletions profile/src/v100/header/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl Header {
impl Header {
/// A placeholder used to facilitate unit tests.
pub fn placeholder() -> Self {
//let date = NaiveDateTime::parse_from_str("2023-09-11T16:05:56", "%Y-%m-%dT%H:%M:%S").unwrap();
//let date = NaiveDateTime::parse_from_str("2023-09-11T16:05:56.000Z", "%Y-%m-%dT%H:%M:%S").unwrap();
let date = Timestamp::parse("2023-09-11T16:05:56Z").unwrap();
let device = DeviceInfo::with_values(
Uuid::from_str("66f07ca2-a9d9-49e5-8152-77aca3d1dd74").unwrap(),
Expand Down Expand Up @@ -200,15 +200,15 @@ pub mod tests {
"id": "12345678-bbbb-cccc-dddd-abcd12345678",
"creatingDevice": {
"id": "66f07ca2-a9d9-49e5-8152-77aca3d1dd74",
"date": "2023-09-11T16:05:56",
"date": "2023-09-11T16:05:56.000Z",
"description": "iPhone"
},
"lastUsedOnDevice": {
"id": "66f07ca2-a9d9-49e5-8152-77aca3d1dd74",
"date": "2023-09-11T16:05:56",
"date": "2023-09-11T16:05:56.000Z",
"description": "iPhone"
},
"lastModified": "2023-09-11T16:05:56",
"lastModified": "2023-09-11T16:05:56.000Z",
"contentHint": {
"numberOfAccountsOnAllNetworksInTotal": 0,
"numberOfPersonasOnAllNetworksInTotal": 0,
Expand Down
7 changes: 4 additions & 3 deletions profile/src/v100/networks/network/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ mod tests {
#[test]
fn set_accounts_same_network() {
assert_ne!(Accounts::placeholder(), Accounts::placeholder_other());
let sut = Network::new(NetworkID::Mainnet, Accounts::placeholder());
assert_eq!(sut.set_accounts(Accounts::placeholder_other()), Ok(()));
assert_eq!(sut.accounts(), Accounts::placeholder_other());
let sut = Network::new(NetworkID::Mainnet, Accounts::placeholder_mainnet());
let new = Accounts::with_account(Account::placeholder_mainnet_bob());
assert_eq!(sut.set_accounts(new.clone()), Ok(()));
assert_eq!(sut.accounts(), new);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion profile/src/v100/networks/networks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mod tests {
fn content_hint() {
assert_eq!(
Networks::placeholder().content_hint(),
ContentHint::with_counters(2, 0, 1)
ContentHint::with_counters(4, 0, 2)
);
}

Expand Down
14 changes: 7 additions & 7 deletions profile/src/v100/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ mod tests {
"id": "12345678-bbbb-cccc-dddd-abcd12345678",
"creatingDevice": {
"id": "66f07ca2-a9d9-49e5-8152-77aca3d1dd74",
"date": "2023-09-11T16:05:56",
"date": "2023-09-11T16:05:56.000Z",
"description": "iPhone"
},
"lastUsedOnDevice": {
"id": "66f07ca2-a9d9-49e5-8152-77aca3d1dd74",
"date": "2023-09-11T16:05:56",
"date": "2023-09-11T16:05:56.000Z",
"description": "iPhone"
},
"lastModified": "2023-09-11T16:05:56",
"lastModified": "2023-09-11T16:05:56.000Z",
"contentHint": {
"numberOfAccountsOnAllNetworksInTotal": 4,
"numberOfPersonasOnAllNetworksInTotal": 0,
Expand All @@ -172,12 +172,12 @@ mod tests {
},
"common": {
"flags": ["main"],
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Unknown Name",
Expand All @@ -194,13 +194,13 @@ mod tests {
"body": "3c986ebf9dcd9167a97036d3b2c997433e85e6cc4e4422ad89269dac7bfea240"
},
"common": {
"addedOn": "2023-09-11T16:05:56",
"addedOn": "2023-09-11T16:05:56.000Z",
"cryptoParameters": {
"supportedCurves": ["curve25519"],
"supportedDerivationPathSchemes": ["cap26"]
},
"flags": ["main"],
"lastUsedOn": "2023-09-11T16:05:56"
"lastUsedOn": "2023-09-11T16:05:56.000Z"
},
"hint": {
"name": "Orange, scratched",
Expand Down

0 comments on commit 1a7c9a2

Please sign in to comment.