-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
395 additions
and
98 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# ElasticNow CLI | ||
|
||
This project was inspired by [Preston Gibbs](mailto:[email protected]) and his hate for time tracking. | ||
This project simplifies timetracking in servicenow for those who find it difficult to navigate. | ||
|
||
## Usage | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
pub mod args; | ||
pub mod config; | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
#[test] | ||
fn test_time_validator() { | ||
assert_eq!(args::range_format_validate("2010-01-01").unwrap(), ()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,58 @@ | ||
pub mod elasticnow; | ||
pub mod servicenow; | ||
pub mod servicenow_structs; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
#[test] | ||
fn test_time_add_to_epoch_basic() { | ||
assert_eq!( | ||
servicenow::time_add_to_epoch("1h2m").unwrap(), | ||
"1970-01-01+01:02:00" | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_time_add_to_epoch_too_many_hours() { | ||
assert_eq!( | ||
servicenow::time_add_to_epoch("20h0m") | ||
.unwrap_err() | ||
.to_string(), | ||
"Invalid time format. Values must be below 20 for hours, 60 for minutes" | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_time_add_to_epoch_too_many_minutes() { | ||
assert_eq!( | ||
servicenow::time_add_to_epoch("0h60m") | ||
.unwrap_err() | ||
.to_string(), | ||
"Invalid time format. Values must be below 20 for hours, 60 for minutes" | ||
); | ||
} | ||
#[test] | ||
fn test_time_only_hour() { | ||
assert_eq!( | ||
servicenow::time_add_to_epoch("1h").unwrap(), | ||
"1970-01-01+01:00:00" | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_time_only_minute() { | ||
assert_eq!( | ||
servicenow::time_add_to_epoch("1m").unwrap(), | ||
"1970-01-01+00:01:00" | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_time_no_time() { | ||
assert_eq!( | ||
servicenow::time_add_to_epoch("0h").unwrap_err().to_string(), | ||
"Time worked must be greater than 0 minutes" | ||
); | ||
} | ||
} |
Oops, something went wrong.