unit test for upsert