All files / output zcl_abapgit_data_utils.clas.testclasses.mjs

100% Statements 71/71
87.5% Branches 7/8
100% Functions 6/6
100% Lines 71/71

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 69 70 711x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
const {zcl_abapgit_data_utils} = await import("./zcl_abapgit_data_utils.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_data_utils.clas.testclasses.abap
class ltcl_data_utils_test {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_DATA_UTILS-LTCL_DATA_UTILS_TEST';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"BUILD_DATA_FILENAME": {"visibility": "I", "parameters": {}},
  "BUILD_CONFIG_FILENAME": {"visibility": "I", "parameters": {}},
  "BUILD_TABLE_ITAB": {"visibility": "I", "parameters": {}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "build_data_filename": this.#build_data_filename.bind(this),
      "build_config_filename": this.#build_config_filename.bind(this),
      "build_table_itab": this.#build_table_itab.bind(this),
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #build_data_filename() {
    let ls_config = new abap.types.Structure({
    "type": new abap.types.Character(4, {"qualifiedName":"zif_abapgit_data_config=>ty_data_type"}),
    "name": new abap.types.Character(40, {}),
    "skip_initial": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "where": abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE")}, "zif_abapgit_data_config=>ty_config", undefined, {}, {});
    ls_config.get().name.set(abap.CharacterFactory.get(4, 'T100'));
    ls_config.get().type.set(abap.CharacterFactory.get(4, 'TABU'));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await abap.Classes['ZCL_ABAPGIT_DATA_UTILS'].build_data_filename({is_config: ls_config})), exp: abap.CharacterFactory.get(14, 't100.tabu.json')});
    ls_config.get().name.set(abap.CharacterFactory.get(10, '/NSPC/T200'));
    ls_config.get().type.set(abap.CharacterFactory.get(4, 'TABU'));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await abap.Classes['ZCL_ABAPGIT_DATA_UTILS'].build_data_filename({is_config: ls_config})), exp: abap.CharacterFactory.get(20, '#nspc#t200.tabu.json')});
  }
  async #build_config_filename() {
    let ls_config = new abap.types.Structure({
    "type": new abap.types.Character(4, {"qualifiedName":"zif_abapgit_data_config=>ty_data_type"}),
    "name": new abap.types.Character(40, {}),
    "skip_initial": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "where": abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE")}, "zif_abapgit_data_config=>ty_config", undefined, {}, {});
    ls_config.get().name.set(abap.CharacterFactory.get(4, 'T100'));
    ls_config.get().type.set(abap.CharacterFactory.get(4, 'TABU'));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await abap.Classes['ZCL_ABAPGIT_DATA_UTILS'].build_config_filename({is_config: ls_config})), exp: abap.CharacterFactory.get(14, 't100.conf.json')});
    ls_config.get().name.set(abap.CharacterFactory.get(10, '/NSPC/T200'));
    ls_config.get().type.set(abap.CharacterFactory.get(4, 'TABU'));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: (await abap.Classes['ZCL_ABAPGIT_DATA_UTILS'].build_config_filename({is_config: ls_config})), exp: abap.CharacterFactory.get(20, '#nspc#t200.conf.json')});
  }
  async #build_table_itab() {
    let lr_data = new abap.types.DataReference(new abap.types.Character(4));
    let ls_row = new abap.types.Structure({
    "sprsl": new abap.types.Character(1, {}),
    "arbgb": new abap.types.Character(20, {}),
    "msgnr": new abap.types.Character(3, {}),
    "text": new abap.types.Character(73, {})}, "T100", "T100", {}, {});
    let fs_lt_tab_ = new abap.types.FieldSymbol(abap.types.TableFactory.construct(new abap.types.Character(4), {"withHeader":false,"keyType":"DEFAULT"}));
    let fs_ls_row_ = new abap.types.FieldSymbol(new abap.types.Character(4));
    lr_data.set((await abap.Classes['ZCL_ABAPGIT_DATA_UTILS'].build_table_itab({iv_name: abap.CharacterFactory.get(4, 'T100')})));
    abap.statements.assign({target: fs_lt_tab_, source: lr_data.dereference()});
    abap.statements.insertInternal({data: ls_row, table: fs_lt_tab_});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_subrc();
    abap.statements.readTable(fs_lt_tab_,{from: ls_row,
      assigning: fs_ls_row_});
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_subrc();
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_DATA_UTILS-LTCL_DATA_UTILS_TEST'] = ltcl_data_utils_test;
export {ltcl_data_utils_test};