MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_delete_current_view

Function test_delete_current_view

atomic-cli/src/commands/view/delete.rs:525–555  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

523 #[test]
524 #[file_serial]
525 fn test_delete_current_view() {
526 use tempfile::tempdir;
527
528 let _guard = DirGuard::new();
529 let temp = tempdir().unwrap();
530 let repo_path = temp.path();
531
532 // Initialize a repository (current view is "dev") and drop to release lock
533 {
534 let _repo = Repository::init(repo_path).unwrap();
535 }
536
537 // Change to the repo directory
538 std::env::set_current_dir(repo_path).unwrap();
539
540 // Try to delete the current view. The plain form routes through
541 // the service area (local backend by default): the domain's
542 // refusal rides the contract's error vocabulary.
543 let cmd = Delete::with_name("dev");
544 let result = cmd.run();
545 assert!(result.is_err());
546 match result.unwrap_err() {
547 CliError::ServiceRefusal { message } => {
548 assert!(
549 message.contains("cannot delete the current view 'dev'"),
550 "unexpected refusal: {message}"
551 );
552 }
553 other => panic!("Expected the current-view refusal, got: {:?}", other),
554 }
555 }
556
557 #[test]
558 #[file_serial]

Callers

nothing calls this directly

Calls 4

initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected