I wrote a decorator simplify smart/dumb components separation in ReactJS,我試圖將測試代碼分解成多個文件並移動colaborator classes to the __mocks__ directory。即使在禁用自動模擬時,是否會自動模擬缺失的依賴關係?
文件結構變成:
src
__mocks__
SharedComponent.js
SomeComponent.js
SomePresenter.js
SpecificPresenter.js
__tests__
index.js
index.js
在測試文件index.js
,加載SomeComponent
我做的:
import SomeComponent from 'SomeComponent'
那類只有在嘲笑目錄存在的,它是用來只是爲了測試裝飾者。 You can see here我沒有明確地嘲笑那個類,並在manual says that auto mocking is disabled by default.
即使在禁用自動模擬時,是否會自動模擬缺少依賴關係?