Skip to content

Commit bc9e3e1

Browse files
committed
util/format_datetime: don't mock for tests
No reason not to test the real thing.
1 parent 6ab1c83 commit bc9e3e1

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

src/rust/bitbox02-rust/src/hww.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ mod tests {
373373
UI_COUNTER += 1;
374374
UI_COUNTER
375375
} {
376-
1 => assert_eq!(params.body, "<date>"),
376+
1 => assert_eq!(params.body, "Mon 2020-09-28"),
377377
2 => assert_eq!(params.body, "Proceed to upgrade?"),
378378
_ => panic!("too many dialogs"),
379379
}
@@ -467,7 +467,7 @@ mod tests {
467467
UI_COUNTER += 1;
468468
UI_COUNTER
469469
} {
470-
1 => assert_eq!(params.body, "<date>"),
470+
1 => assert_eq!(params.body, "Mon 2020-09-28"),
471471
2 => assert_eq!(params.title, "RESET"),
472472
3 => assert_eq!(params.body, "Restore backup?"),
473473
4 => assert!(params.body.starts_with("Name: test device name.")),

src/rust/bitbox02-rust/src/hww/api/backup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ mod tests {
174174
mock(Data {
175175
sdcard_inserted: Some(true),
176176
ui_confirm_create: Some(Box::new(|params| {
177-
assert_eq!(params.body, "<date>");
177+
assert_eq!(params.body, "Mon 2020-09-28");
178178
true
179179
})),
180180
..Default::default()

src/rust/bitbox02/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ pub fn strftime(timestamp: u32, format: &str) -> String {
131131
.into()
132132
}
133133

134-
#[cfg(not(feature = "testing"))]
135134
pub fn format_datetime(timestamp: u32, timezone_offset: i32, date_only: bool) -> String {
136135
let mut out = [0u8; 100];
137136
unsafe {
@@ -148,15 +147,6 @@ pub fn format_datetime(timestamp: u32, timezone_offset: i32, date_only: bool) ->
148147
.into()
149148
}
150149

151-
#[cfg(feature = "testing")]
152-
pub fn format_datetime(_timestamp: u32, _timezone_offset: i32, date_only: bool) -> String {
153-
if date_only {
154-
"<date>".into()
155-
} else {
156-
"<datetime>".into()
157-
}
158-
}
159-
160150
#[cfg(not(feature = "testing"))]
161151
pub fn reboot() -> ! {
162152
unsafe { bitbox02_sys::reboot() }

0 commit comments

Comments
 (0)