如何消費這個 Directive:

我們可以 mock FeatureLevelDirective 的服務類:
isLevel 的判斷邏輯:
進行 Component 單元測試時,我們可以使用下面的 MockFeatureLevelDirective 進行 Mock.
import { MockFeatureLevelDirective } from '../../../../shared/test/mock-feature-level-directive';
import {
FeaturesConfigModule,
I18nTestingModule,
PromotionLocation,
} from '@spartacus/core';
FeaturesConfigModule