test(api): refactor driver api reject tests to reduce duplication