Add more exhaustive tests for .asTypeOf (#4160)
This includes changing AsTypeOfSpec to be FunSpec instead of FlatSpec so that the tests can have more structure.
This includes changing AsTypeOfSpec to be FunSpec instead of FlatSpec so that the tests can have more structure.