| 248 | |
| 249 | #[test] |
| 250 | fn parent_topic_added() { |
| 251 | let f = Fixtures::copy("simple"); |
| 252 | let repo_id = RepoId::wiki(); |
| 253 | let parent = f.topic(repo_id, "00001"); |
| 254 | assert_eq!(parent.children, BTreeSet::new()); |
| 255 | |
| 256 | let child = f.topic(repo_id, "00002"); |
| 257 | assert!(!parent.has_child(child.topic_id())); |
| 258 | |
| 259 | let result = UpdateTopicParentTopics { |
| 260 | actor: actor(), |
| 261 | repo_id, |
| 262 | topic_id: child.topic_id(), |
| 263 | parent_topic_ids: &[parent.topic_id().to_owned()], |
| 264 | } |
| 265 | .call(f.mutation(), &redis::Noop) |
| 266 | .unwrap(); |
| 267 | |
| 268 | assert_eq!(result.repo_topic, child); |
| 269 | |
| 270 | let parent = f.topic(repo_id, "00001"); |
| 271 | let child = f.topic(repo_id, "00002"); |
| 272 | assert!(parent.has_child(child.topic_id())); |
| 273 | } |
| 274 | |
| 275 | #[test] |
| 276 | fn parent_topic_removed() { |