()
| 739 | |
| 740 | #[test] |
| 741 | fn create_distinct() { |
| 742 | let f = Fixtures::copy("simple"); |
| 743 | let repo_id = RepoId::wiki(); |
| 744 | let topic_id = parse_id("00001"); |
| 745 | |
| 746 | let result = f |
| 747 | .upsert_topic(repo_id, "Topic name", &topic_id, OnMatchingSynonym::Ask) |
| 748 | .unwrap(); |
| 749 | assert!(result.saved); |
| 750 | let path1 = &result.repo_topic.unwrap().metadata.id; |
| 751 | |
| 752 | let topic_path = parse_id("00002"); |
| 753 | let result = f |
| 754 | .upsert_topic( |
| 755 | repo_id, |
| 756 | "Topic name", |
| 757 | &topic_path, |
| 758 | OnMatchingSynonym::CreateDistinct, |
| 759 | ) |
| 760 | .unwrap(); |
| 761 | |
| 762 | assert!(result.repo_topic.is_some()); |
| 763 | assert!(result.saved); |
| 764 | let path2 = &result.repo_topic.unwrap().metadata.id; |
| 765 | |
| 766 | assert_ne!(path1, path2); |
| 767 | |
| 768 | let matches = f |
| 769 | .git |
| 770 | .synonym_phrase_matches(&actor().read_repo_ids, "Topic name") |
| 771 | .unwrap(); |
| 772 | let mut names = matches |
| 773 | .iter() |
| 774 | .map(|m| m.entry.name.to_owned()) |
| 775 | .collect::<Vec<String>>(); |
| 776 | names.sort(); |
| 777 | assert_eq!(names, vec!["Topic name", "Topic name"]); |
| 778 | } |
| 779 | |
| 780 | #[test] |
| 781 | fn parent_topic_updated() { |
nothing calls this directly
no test coverage detected