rustfmt
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
84674650e7
commit
32ab30df7e
4 changed files with 16 additions and 17 deletions
|
|
@ -2456,7 +2456,12 @@ fn a_result_that_made_no_api_call_bills_nothing() {
|
|||
// CLI reported rows: the reservation stands.
|
||||
("", 2300, empty, false),
|
||||
(r#""api_error_status":500,"#, 0, empty, false),
|
||||
(r#""api_error_status":null,"#, 0, r#","model_usage_since_last_result":"?""#, false),
|
||||
(
|
||||
r#""api_error_status":null,"#,
|
||||
0,
|
||||
r#","model_usage_since_last_result":"?""#,
|
||||
false,
|
||||
),
|
||||
];
|
||||
for (status, api_ms, extra, free) in cases {
|
||||
let line = not_logged_in_line(status, api_ms, extra);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@ mod tests {
|
|||
let cell = QuotaCell::new();
|
||||
cell.observe_at(100, [quota("five_hour", 80, 0)]);
|
||||
cell.observe_at(900, Vec::new());
|
||||
assert_eq!(cell.snapshot_at(950).windows, vec![quota("five_hour", 80, 100)]);
|
||||
assert_eq!(
|
||||
cell.snapshot_at(950).windows,
|
||||
vec![quota("five_hour", 80, 100)]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -123,7 +126,10 @@ mod tests {
|
|||
assert_eq!(expired.len(), 1);
|
||||
assert_eq!(expired[0].status, "expired");
|
||||
assert_eq!(expired[0].utilization_permille, None);
|
||||
assert_eq!(expired[0].observed_at_unix_ms, 100, "its age stays readable");
|
||||
assert_eq!(
|
||||
expired[0].observed_at_unix_ms, 100,
|
||||
"its age stays readable"
|
||||
);
|
||||
assert_eq!(expired[0].resets_at_unix_ms, RESET);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -357,11 +357,7 @@ fn fail(kind: FailureKind, message: &'static str) -> Step {
|
|||
/// 403 or 429, or a call never made); elsewhere the CLI also zeroes usage on
|
||||
/// crashes after real work. A call never made (`absent_is_zero`) may also
|
||||
/// omit the field. `None` is billed the reservation by the kit.
|
||||
fn read_usage(
|
||||
reported: Option<Value>,
|
||||
empty_is_zero: bool,
|
||||
absent_is_zero: bool,
|
||||
) -> Option<Usage> {
|
||||
fn read_usage(reported: Option<Value>, empty_is_zero: bool, absent_is_zero: bool) -> Option<Usage> {
|
||||
let Some(reported) = reported else {
|
||||
return absent_is_zero.then(|| sum_usage(std::iter::empty()));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -107,15 +107,7 @@ mod tests {
|
|||
panic!("a readout is a map, not a positional array");
|
||||
};
|
||||
let names: Vec<&str> = fields.iter().filter_map(|(k, _)| k.as_str()).collect();
|
||||
assert_eq!(
|
||||
names,
|
||||
[
|
||||
"schema_id",
|
||||
"at_unix_ms",
|
||||
"callers",
|
||||
"plan_quota"
|
||||
]
|
||||
);
|
||||
assert_eq!(names, ["schema_id", "at_unix_ms", "callers", "plan_quota"]);
|
||||
assert_eq!(wire_decode::<SpendReadout>(&bytes).unwrap(), readout());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue