refactor(tests): replace deprecated `toThrow` with `toThrowWith`