Can't pass the last test of Delete a Leaf Node in a Binary Search Tree

Can’t pass the last one, The remove method should remove leaf nodes from the tree. I cannot find out what is wrong.

https://www.freecodecamp.org/learn/coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree

var displayTree = tree => console.log(JSON.stringify(tree, null, 2));
function Node(value) {
  this.value = value;
  this.left = null;
  this.right = null;
}

function BinarySearchTree() {
  this.root = null;
  // case 1: target has no children, change code below this line

  this.remove = function(node, data) {
      if(!node) {      
      return null
    } 
    if (node.value == data && node.left == null && node.right == null) {
      this.root = null
      return null
    } else if (data < node.value) {
      node.left = this.remove(node.left, data)
      return node
    } else if (data > node.value) {
      node.right = this.remove(node.right, data)
      return node
    }
  }
}