All files / output zcl_abapgit_persistence_user.clas.testclasses.mjs

13.08% Statements 14/107
66.66% Branches 2/3
50% Functions 1/2
13.08% Lines 14/107

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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 1071x 1x 1x                   1x 1x 1x                                                                                                                                                                         1x 1x 1x 1x 1x 1x 1x 1x
const {zcl_abapgit_persistence_user} = await import("./zcl_abapgit_persistence_user.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_persistence_user.clas.testclasses.abap
class ltcl_user {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_PERSISTENCE_USER-LTCL_USER';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MI_USER": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_PERSIST_USER"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "C_ABAP_USER": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"sy-uname"});}, "visibility": "I", "is_constant": "X", "is_class": "X"},
  "C_GIT_USER": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": "X", "is_class": "X"},
  "C_REPO_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": "X", "is_class": "X"}};
  static METHODS = {"SET_GET_GIT_USER": {"visibility": "I", "parameters": {}},
  "SET_GET_REPO_SHOW": {"visibility": "I", "parameters": {}},
  "SET_GET_SETTINGS": {"visibility": "I", "parameters": {}},
  "SET_GET_REPO_LOGIN": {"visibility": "I", "parameters": {}},
  "TEARDOWN": {"visibility": "I", "parameters": {}}};
  #mi_user;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "set_get_git_user": this.#set_get_git_user.bind(this),
      "set_get_repo_show": this.#set_get_repo_show.bind(this),
      "set_get_settings": this.#set_get_settings.bind(this),
      "set_get_repo_login": this.#set_get_repo_login.bind(this),
      "teardown": this.#teardown.bind(this),
    };
    this.#mi_user = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_PERSIST_USER"});
    this.FRIENDS_ACCESS_INSTANCE["mi_user"] = this.#mi_user;
    this.c_abap_user = ltcl_user.c_abap_user;
    this.c_git_user = ltcl_user.c_git_user;
    this.c_repo_url = ltcl_user.c_repo_url;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #set_get_git_user() {
    let lv_user = new abap.types.String({qualifiedName: "STRING"});
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    await this.#mi_user.get().zif_abapgit_persist_user$set_default_git_user_name({iv_username: ltcl_user.c_git_user});
    this.#mi_user.clear();
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    lv_user.set((await this.#mi_user.get().zif_abapgit_persist_user$get_default_git_user_name()));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_user, exp: ltcl_user.c_git_user});
  }
  async #set_get_repo_show() {
    let lv_key = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});
    let lv_repo_key = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});
    await abap.statements.select(lv_repo_key, {select: "SELECT MIN( value ) FROM " + abap.buildDbTableName(abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].c_tabname.get().trimEnd().toLowerCase()) + " WHERE \"type\" = '" + abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].c_type_repo.get() + "'"});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      return;
    }
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    await this.#mi_user.get().zif_abapgit_persist_user$set_repo_show({iv_key: lv_repo_key});
    this.#mi_user.clear();
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    lv_key.set((await this.#mi_user.get().zif_abapgit_persist_user$get_repo_show()));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_key, exp: lv_repo_key});
  }
  async #set_get_repo_login() {
    let lv_login = new abap.types.String({qualifiedName: "STRING"});
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    await this.#mi_user.get().zif_abapgit_persist_user$set_repo_login({iv_url: ltcl_user.c_repo_url, iv_login: ltcl_user.c_git_user});
    this.#mi_user.clear();
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    lv_login.set((await this.#mi_user.get().zif_abapgit_persist_user$get_repo_login({iv_url: ltcl_user.c_repo_url})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_login, exp: ltcl_user.c_git_user});
  }
  async #set_get_settings() {
    let ls_settings = new abap.types.Structure({
    "max_lines": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-MAX_LINES"}),
    "adt_jump_enabled": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "show_default_repo": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "link_hints_enabled": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "link_hint_key": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_persist_user=>ty_s_user_settings-link_hint_key"}),
    "parallel_proc_disabled": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "icon_scaling": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_persist_user=>ty_s_user_settings-icon_scaling"}),
    "ui_theme": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-UI_THEME"}),
    "hide_sapgui_hint": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "activate_wo_popup": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "label_colors": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-LABEL_COLORS"}),
    "default_git_uname": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-DEFAULT_GIT_UNAME"}),
    "default_git_email": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-DEFAULT_GIT_EMAIL"})}, "zif_abapgit_persist_user=>ty_s_user_settings", undefined, {}, {});
    ls_settings.get().show_default_repo.set(abap.builtin.abap_true);
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    await this.#mi_user.get().zif_abapgit_persist_user$set_settings({is_user_settings: ls_settings});
    this.#mi_user.clear();
    this.#mi_user.set((await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user({iv_user: ltcl_user.c_abap_user})));
    ls_settings.set((await this.#mi_user.get().zif_abapgit_persist_user$get_settings()));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: ls_settings.get().show_default_repo, exp: abap.builtin.abap_true});
  }
  async #teardown() {
    await (await abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].get_instance()).get().delete({iv_type: abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].c_type_user, iv_value: ltcl_user.c_abap_user});
    if (abap.FunctionModules['DB_COMMIT'] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} }
    await abap.FunctionModules['DB_COMMIT']();
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_PERSISTENCE_USER-LTCL_USER'] = ltcl_user;
ltcl_user.c_abap_user = new abap.types.Character(12, {"qualifiedName":"sy-uname"});
ltcl_user.c_abap_user.set('ABAPGIT_TEST');
ltcl_user.c_git_user = new abap.types.String({qualifiedName: "STRING"});
ltcl_user.c_git_user.set('abapgit_tester');
ltcl_user.c_repo_url = new abap.types.String({qualifiedName: "STRING"});
ltcl_user.c_repo_url.set('https://github.com/abapGit/abapGit');
export {ltcl_user};