write update method and test for promise var