Я попробовал это:
android:backgroundTint:"@color/mycolor"
вместо изменения свойства фона. Это не устраняет материальный эффект.
method1
существует в ABC.prototype
, и вы можете шпионить за ним и заменить реализацию до создания нового экземпляра ABC
:
class ABC {
constructor() {
this.method1();
}
method1() {
throw new Error('should not get here');
}
}
test('ABC', () => {
const spy = jest.spyOn(ABC.prototype, 'method1'); // spy on the method of the prototype
spy.mockImplementation(() => {}); // replace the implementation
const abc = new ABC(); // no error
expect(spy).toHaveBeenCalled(); // SUCCESS
})