build-next-state-fn unit test