use std::sync::Arc;

use crate::test;

use super::PathNode;

#[test]
fn should_match_path() {
    test::setup();

    let root = Arc::new(PathNode::Root);
    let path_a = Arc::new(PathNode::Array {
        parent: Arc::clone(&root),
        index: 1,
    });
    let path_b = Arc::new(PathNode::Object {
        parent: Arc::clone(&path_a),
        key: r#""name""#.into(),
    });
    let path_c = PathNode::Object {
        parent: Arc::clone(&path_b),
        key: r#""gene""#.into(),
    };

    assert_eq!(*root, "$");
    assert_eq!(*path_a, "$.1");
    assert_eq!(*path_b, "$.1.name");
    assert_eq!(path_c, "$.1.name.gene");
}
