All files / output zcl_abapgit_feature.clas.testclasses.mjs

89.85% Statements 62/69
69.23% Branches 9/13
80% Functions 8/10
89.85% Lines 62/69

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 691x 1x 1x 3x 3x 3x 3x 3x 3x 3x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x       1x 3x 1x     1x 1x 1x 3x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 1x 1x
const {zcl_abapgit_feature} = await import("./zcl_abapgit_feature.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_feature.clas.testclasses.abap
class ltcl_feature {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_FEATURE-LTCL_FEATURE';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MO_SETTINGS": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MO_CUT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_FEATURE", RTTIName: "\\CLASS=ZCL_ABAPGIT_FEATURE"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"SETUP": {"visibility": "I", "parameters": {}},
  "MERGED_DISABLED": {"visibility": "I", "parameters": {}},
  "FEATURE_DISABLED": {"visibility": "I", "parameters": {}},
  "FEATURE_ENABLED": {"visibility": "I", "parameters": {}}};
  #mo_settings;
  #mo_cut;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "setup": this.#setup.bind(this),
      "merged_disabled": this.#merged_disabled.bind(this),
      "feature_disabled": this.#feature_disabled.bind(this),
      "feature_enabled": this.#feature_enabled.bind(this),
    };
    this.#mo_settings = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"});
    this.FRIENDS_ACCESS_INSTANCE["mo_settings"] = this.#mo_settings;
    this.#mo_cut = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_FEATURE", RTTIName: "\\CLASS=ZCL_ABAPGIT_FEATURE"});
    this.FRIENDS_ACCESS_INSTANCE["mo_cut"] = this.#mo_cut;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #setup() {
    this.#mo_cut.set(await (new abap.Classes['ZCL_ABAPGIT_FEATURE']()).constructor_());
    this.#mo_settings.set((await (await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_settings()).get().zif_abapgit_persist_settings$read()));
  }
  async #merged_disabled() {
    if (abap.compare.eq((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_environment()).get().zif_abapgit_environment$is_merged()), abap.builtin.abap_true)) {
      await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled()), exp: abap.builtin.abap_false});
      await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'TEST')})), exp: abap.builtin.abap_false});
    }
  }
  async #feature_disabled() {
    if (abap.compare.eq((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_environment()).get().zif_abapgit_environment$is_merged()), abap.builtin.abap_true)) {
      return;
    }
    await this.#mo_settings.get().set_experimental_features({iv_features: abap.CharacterFactory.get(1, '')});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'TEST')})), exp: abap.builtin.abap_false});
  }
  async #feature_enabled() {
    if (abap.compare.eq((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_environment()).get().zif_abapgit_environment$is_merged()), abap.builtin.abap_true)) {
      return;
    }
    await this.#mo_settings.get().set_experimental_features({iv_features: abap.CharacterFactory.get(1, 'X')});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'TEST')})), exp: abap.builtin.abap_true});
    await this.#mo_settings.get().set_experimental_features({iv_features: abap.CharacterFactory.get(4, 'TEST')});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'TEST')})), exp: abap.builtin.abap_true});
    await this.#mo_settings.get().set_experimental_features({iv_features: abap.CharacterFactory.get(7, 'AFF,LXE')});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'TEST')})), exp: abap.builtin.abap_false});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(3, 'AFF')})), exp: abap.builtin.abap_true});
    await this.#mo_settings.get().set_experimental_features({iv_features: abap.CharacterFactory.get(19, ' AFF , FLOW   ,LXE ')});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'TEST')})), exp: abap.builtin.abap_false});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await this.#mo_cut.get().is_enabled({iv_feature: abap.CharacterFactory.get(4, 'FLOW')})), exp: abap.builtin.abap_true});
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_FEATURE-LTCL_FEATURE'] = ltcl_feature;
export {ltcl_feature};