All files / output zcl_abapgit_integration_gitv2.clas.testclasses.mjs

9.52% Statements 8/84
66.66% Branches 2/3
50% Functions 1/2
9.52% Lines 8/84

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 71 72 73 74 75 76 77 78 79 80 81 82 83 841x 1x 1x             1x 1x 1x                                                                                                                                             1x 1x
const {zcl_abapgit_integration_gitv2} = await import("./zcl_abapgit_integration_gitv2.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_integration_gitv2.clas.testclasses.abap
class ltcl_test {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_INTEGRATION_GITV2-LTCL_TEST';
  static IMPLEMENTED_INTERFACES = ["IF_FTD_INVOCATION_ANSWER"];
  static ATTRIBUTES = {"MI_ENV": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_FUNCTION_TEST_ENVIRONMENT", RTTIName: "\\INTERFACE=IF_FUNCTION_TEST_ENVIRONMENT"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"SETUP": {"visibility": "I", "parameters": {}},
  "TEARDOWN": {"visibility": "I", "parameters": {}},
  "LIST_BRANCHES": {"visibility": "I", "parameters": {}},
  "LIST_NO_BLOBS": {"visibility": "I", "parameters": {}},
  "COMMITS_LAST_YEAR": {"visibility": "I", "parameters": {}}};
  #mi_env;
  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),
      "teardown": this.#teardown.bind(this),
      "list_branches": this.#list_branches.bind(this),
      "list_no_blobs": this.#list_no_blobs.bind(this),
      "commits_last_year": this.#commits_last_year.bind(this),
    };
    this.#mi_env = new abap.types.ABAPObject({qualifiedName: "IF_FUNCTION_TEST_ENVIRONMENT", RTTIName: "\\INTERFACE=IF_FUNCTION_TEST_ENVIRONMENT"});
    this.FRIENDS_ACCESS_INSTANCE["mi_env"] = this.#mi_env;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #setup() {
    let lt_deps = abap.types.TableFactory.construct(new abap.types.Character(30, {"qualifiedName":"SXCO_FM_NAME","ddicName":"SXCO_FM_NAME","description":"Function module name"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":["TABLE_LINE"]},"secondary":[]}, "if_function_test_environment=>tt_function_dependencies");
    abap.statements.insertInternal({data: abap.CharacterFactory.get(25, 'SAPGUI_PROGRESS_INDICATOR'), table: lt_deps});
    this.#mi_env.set((await abap.Classes['CL_FUNCTION_TEST_ENVIRONMENT'].create({function_modules: lt_deps})));
    await (await (await (await this.#mi_env.get().if_function_test_environment$get_double({function_name: abap.CharacterFactory.get(25, 'SAPGUI_PROGRESS_INDICATOR')})).get().if_function_testdouble$configure_call()).get().if_ftd_input_config_setter$ignore_all_parameters()).get().if_ftd_output_config_setter$then_answer({answer: this.me});
  }
  async #teardown() {
    await this.#mi_env.get().if_function_test_environment$clear_doubles();
  }
  async if_ftd_invocation_answer$answer(INPUT) {
    let $arguments = INPUT?.arguments;
    if ($arguments?.getQualifiedName === undefined || $arguments.getQualifiedName() !== "IF_FTD_INPUT_ARGUMENTS") { $arguments = undefined; }
    if ($arguments === undefined) { $arguments = new abap.types.ABAPObject({qualifiedName: "IF_FTD_INPUT_ARGUMENTS", RTTIName: "\\INTERFACE=IF_FTD_INPUT_ARGUMENTS"}).set(INPUT.arguments); }
    let result = new abap.types.ABAPObject({qualifiedName: "IF_FTD_INVOCATION_RESULT", RTTIName: "\\INTERFACE=IF_FTD_INVOCATION_RESULT"});
    if (INPUT && INPUT.result) {result = INPUT.result;}
    return;
  }
  async #list_branches() {
    let lo_list = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_GIT_BRANCH_LIST", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_GIT_BRANCH_LIST"});
    let lt_branches = abap.types.TableFactory.construct(new abap.types.Structure({
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-NAME"}),
    "type": new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"}),
    "is_head": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "display_name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-DISPLAY_NAME"})}, "zif_abapgit_git_definitions=>ty_git_branch", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"name_key","type":"SORTED","isUnique":false,"keyFields":["NAME"]}]}, "zif_abapgit_git_definitions=>ty_git_branch_list_tt");
    lo_list.set((await (await abap.Classes['ZCL_ABAPGIT_GIT_FACTORY'].get_v2_porcelain()).get().zif_abapgit_gitv2_porcelain$list_branches({iv_url: abap.CharacterFactory.get(38, 'https://github.com/abapGit/abapGit.git'), iv_prefix: abap.CharacterFactory.get(10, 'refs/heads')})));
    lt_branches.set((await lo_list.get().zif_abapgit_git_branch_list$get_all()));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_number_between({number: abap.builtin.lines({val: lt_branches}), lower: abap.IntegerFactory.get(0), upper: abap.IntegerFactory.get(100)});
  }
  async #list_no_blobs() {
    let lt_expanded = abap.types.TableFactory.construct(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-PATH"}),
    "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-NAME"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "chmod": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_chmod"})}, "zif_abapgit_git_definitions=>ty_expanded", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"path_name","type":"SORTED","isUnique":false,"keyFields":["PATH","NAME"]}]}, "zif_abapgit_git_definitions=>ty_expanded_tt");
    lt_expanded.set((await (await abap.Classes['ZCL_ABAPGIT_GIT_FACTORY'].get_v2_porcelain()).get().zif_abapgit_gitv2_porcelain$list_no_blobs({iv_url: abap.CharacterFactory.get(38, 'https://github.com/abapGit/abapGit.git'), iv_sha1: abap.CharacterFactory.get(40, '7bdd8f9f4c6bb0ece461b78c7b559957fad6c3ae')})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_number_between({number: abap.builtin.lines({val: lt_expanded}), lower: abap.IntegerFactory.get(0), upper: new abap.types.Integer().set(5000)});
  }
  async #commits_last_year() {
    let lt_objects = abap.types.TableFactory.construct(new abap.types.Structure({
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "type": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_type"}),
    "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-DATA"}),
    "adler32": new abap.types.Hex({length: 4}),
    "index": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-INDEX"})}, "zif_abapgit_definitions=>ty_object", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"sha","type":"SORTED","isUnique":false,"keyFields":["SHA1"]},{"name":"type","type":"SORTED","isUnique":false,"keyFields":["TYPE","SHA1"]}]}, "zif_abapgit_definitions=>ty_objects_tt");
    let lt_sha1 = abap.types.TableFactory.construct(new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_git_definitions=>ty_sha1_tt");
    abap.statements.insertInternal({data: abap.CharacterFactory.get(40, 'e83a31ebafde4e8e7e80ca36662e42e8f20895c5'), table: lt_sha1});
    lt_objects.set((await (await abap.Classes['ZCL_ABAPGIT_GIT_FACTORY'].get_v2_porcelain()).get().zif_abapgit_gitv2_porcelain$commits_last_year({iv_url: abap.CharacterFactory.get(38, 'https://github.com/abapGit/abapGit.git'), it_sha1: lt_sha1})));
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_INTEGRATION_GITV2-LTCL_TEST'] = ltcl_test;
export {ltcl_test};