Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions credential-exchange-format/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- **BREAKING**: Changed `integration_hash` to `integrity_hash` in `FileCredential`. (#87)
- **BREAKING**: Renamed `ty` to `type` in serialized representations of `Credential::Unknown`.
(#125)
- **BREAKING**: Field values are now using a new type to encode whether the field was parsed as the
expected field type, or whether the field was of the wrong type. (#127)

### Fixed

Expand Down
16 changes: 8 additions & 8 deletions credential-exchange-format/src/document.rs
Comment thread
rbartlensky marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ mod tests {
fields: vec![
EditableFieldValue::<()>::String(EditableField {
id: Some(B64Url::from(b"field1".as_slice())),
value: EditableFieldString("hello".into()),
value: EditableFieldString("hello".into()).into(),
label: None,
extensions: None,
}),
EditableFieldValue::<()>::Boolean(EditableField {
id: None,
value: EditableFieldBoolean(false),
value: EditableFieldBoolean(false).into(),
label: None,
extensions: None,
}),
Expand Down Expand Up @@ -129,33 +129,33 @@ mod tests {

match &credential.fields[0] {
EditableFieldValue::String(field) => {
assert_eq!(field.value.0, "hello");
assert_eq!(field.value.as_expected().map(|v| v.0.as_str()), Ok("hello"));
Comment thread
Hinton marked this conversation as resolved.
}
_ => panic!("Expected string field"),
}

match &credential.fields[1] {
EditableFieldValue::ConcealedString(field) => {
assert_eq!(field.value.0, "world");
assert_eq!(field.value.as_expected().map(|v| v.0.as_str()), Ok("world"));
}
_ => panic!("Expected concealed string field"),
}

match &credential.fields[2] {
EditableFieldValue::Boolean(field) => {
assert!(!field.value.0);
assert_eq!(field.value.as_expected().map(|e| e.0), Ok(false));
}
_ => panic!("Expected boolean field"),
}

match &credential.fields[3] {
EditableFieldValue::YearMonth(field) => {
assert_eq!(
field.value,
EditableFieldYearMonth {
field.value.as_expected(),
Ok(&EditableFieldYearMonth {
year: 2025,
month: Month::February,
}
})
);
}
_ => panic!("Expected boolean field"),
Expand Down
Loading
Loading