Completed assignment with testthat tests