Skip to content

Commit 3e77a90

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Add a developer_index_config test (#40147)
This helps us manually see the format - so if we change it we can see the effects. GitOrigin-RevId: 231e70072c887d5e6b5d86898bbfd16b20a1f408
1 parent 56f4cc2 commit 3e77a90

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

crates/model/src/deployment_audit_log/developer_index_config.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,25 @@ impl TryFrom<SerializedDeveloperIndexConfig> for DeveloperIndexConfig {
8787
}
8888

8989
codegen_convex_serialization!(DeveloperIndexConfig, SerializedDeveloperIndexConfig);
90+
91+
#[cfg(test)]
92+
mod tests {
93+
use common::bootstrap_model::index::database_index::IndexedFields;
94+
95+
use super::*;
96+
97+
#[test]
98+
fn test_developer_index_config_serialization() -> anyhow::Result<()> {
99+
let config = DeveloperIndexConfig::Database(DatabaseIndexSpec {
100+
fields: IndexedFields::creation_time(),
101+
});
102+
let serialized = SerializedDeveloperIndexConfig::try_from(config.clone()).unwrap();
103+
let json = serde_json::to_value(&serialized)?;
104+
let expected = serde_json::json!({
105+
"type": "database",
106+
"fields": ["_creationTime"],
107+
});
108+
assert_eq!(json, expected);
109+
Ok(())
110+
}
111+
}

0 commit comments

Comments
 (0)