All files / output zcl_abapgit_utils.clas.testclasses.mjs

98.33% Statements 118/120
94.73% Branches 18/19
73.91% Functions 17/23
98.33% Lines 118/120

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 107 108 109 110 111 112 113 114 115 116 117 118 119 1201x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x     4x 1x 1x 1x 4x 1x 1x 1x 1x 4x 1x 1x 1x 1x 4x 1x 1x 1x 1x 4x 1x 1x 1x 1x 4x 1x 1x 4x 2x 2x 2x 2x 2x 4x 1x 1x 4x 1x 1x 4x 1x 1x 1x 1x 4x 4x 4x 4x 3x 3x 4x 1x 1x 4x 1x 1x 1x 1x 1x
const {zcl_abapgit_utils} = await import("./zcl_abapgit_utils.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_utils.clas.testclasses.abap
class ltcl_is_binary {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_UTILS-LTCL_IS_BINARY';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"GV_NL": {"type": () => {return new abap.types.Character(1, {});}, "visibility": "I", "is_constant": " ", "is_class": "X"},
  "GV_CR_LF": {"type": () => {return new abap.types.Character(2, {});}, "visibility": "I", "is_constant": " ", "is_class": "X"},
  "MV_GIVEN_FILE": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MV_ACT_IS_BINARY": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"CDS_METADATA_IS_TEXT": {"visibility": "I", "parameters": {}},
  "CDS_WITH_UMLAUT_IS_TEXT": {"visibility": "I", "parameters": {}},
  "IMAGE_IS_BINARY": {"visibility": "I", "parameters": {}},
  "TEXT_IS_NOT_BINARY": {"visibility": "I", "parameters": {}},
  "GIVEN_FILE": {"visibility": "I", "parameters": {"IV_FILE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "StringType"}}},
  "GIVEN_IMAGE": {"visibility": "I", "parameters": {}},
  "GIVEN_CDS_METADATA": {"visibility": "I", "parameters": {}},
  "GIVEN_CDS_VIEW_WITH_UMLAUT": {"visibility": "I", "parameters": {}},
  "GIVEN_TEXT": {"visibility": "I", "parameters": {}},
  "WHEN_IS_BINARY_DETERMINED": {"visibility": "I", "parameters": {}},
  "THEN_IS_NOT_BINARY": {"visibility": "I", "parameters": {}},
  "THEN_IS_BINARY": {"visibility": "I", "parameters": {}},
  "CLASS_CONSTRUCTOR": {"visibility": "U", "parameters": {}}};
  #gv_nl;
  #gv_cr_lf;
  #mv_given_file;
  #mv_act_is_binary;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "cds_metadata_is_text": this.#cds_metadata_is_text.bind(this),
      "cds_with_umlaut_is_text": this.#cds_with_umlaut_is_text.bind(this),
      "image_is_binary": this.#image_is_binary.bind(this),
      "text_is_not_binary": this.#text_is_not_binary.bind(this),
      "given_file": this.#given_file.bind(this),
      "given_image": this.#given_image.bind(this),
      "given_cds_metadata": this.#given_cds_metadata.bind(this),
      "given_cds_view_with_umlaut": this.#given_cds_view_with_umlaut.bind(this),
      "given_text": this.#given_text.bind(this),
      "when_is_binary_determined": this.#when_is_binary_determined.bind(this),
      "then_is_not_binary": this.#then_is_not_binary.bind(this),
      "then_is_binary": this.#then_is_binary.bind(this),
    };
    this.gv_nl = ltcl_is_binary.gv_nl;
    this.gv_cr_lf = ltcl_is_binary.gv_cr_lf;
    this.#mv_given_file = new abap.types.XString({qualifiedName: "XSTRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_given_file"] = this.#mv_given_file;
    this.#mv_act_is_binary = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    this.FRIENDS_ACCESS_INSTANCE["mv_act_is_binary"] = this.#mv_act_is_binary;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async class_constructor() {
    return ltcl_is_binary.class_constructor();
  }
  static async class_constructor() {
    ltcl_is_binary.gv_nl.set(abap.Classes['CL_ABAP_CHAR_UTILITIES'].newline);
    ltcl_is_binary.gv_cr_lf.set(abap.Classes['CL_ABAP_CHAR_UTILITIES'].cr_lf);
  }
  async #cds_metadata_is_text() {
    await this.#given_cds_metadata();
    await this.#when_is_binary_determined();
    await this.#then_is_not_binary();
  }
  async #cds_with_umlaut_is_text() {
    await this.#given_cds_view_with_umlaut();
    await this.#when_is_binary_determined();
    await this.#then_is_not_binary();
  }
  async #image_is_binary() {
    await this.#given_image();
    await this.#when_is_binary_determined();
    await this.#then_is_binary();
  }
  async #text_is_not_binary() {
    await this.#given_text();
    await this.#when_is_binary_determined();
    await this.#then_is_not_binary();
  }
  async #given_text() {
    this.#mv_given_file.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].string_to_xstring_utf8({iv_string: abap.operators.concat(abap.CharacterFactory.get(4, 'Test'),abap.Classes['CL_ABAP_CHAR_UTILITIES'].cr_lf)})));
  }
  async #given_file(INPUT) {
    let iv_file = INPUT?.iv_file;
    if (iv_file?.getQualifiedName === undefined || iv_file.getQualifiedName() !== "STRING") { iv_file = undefined; }
    if (iv_file === undefined) { iv_file = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_file); }
    this.#mv_given_file.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].string_to_xstring_utf8({iv_string: iv_file})));
  }
  async #given_image() {
    this.#mv_given_file.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].base64_to_xstring({iv_base64: abap.operators.concat(new abap.types.String().set(`iVBORw0KGgoAAAANSUhEUgAAALEAAAA1CAYAAAAOCAoLAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8Y`),abap.operators.concat(new abap.types.String().set(`QUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAecSURBVHhe7ZvLilxVFIb1BfQFdOxAcaAgJIgX8B4HOkkPHB`),abap.operators.concat(new abap.types.String().set(`kxOjFiFBRaEIzowIEYBVGQBMULeIsjFeNI0YGT6EzsB+jETuIblP0V7mbVqn/vs06dc6rqdPbgg+4+a1/`),abap.operators.concat(new abap.types.String().set(`O3t++VvVV29vbk0plzFSJK6OnSlwZPVXiyuipEldGT5W4MnoGk3jn848nl44/Pdn58D35vFLpi0Ekvvjy`),abap.operators.concat(new abap.types.String().set(`85N/b795D35XcZVKH/QusRe4ilwZml4lzgmcqCJXhqBXiXc2j0t5LVXkSt/0IvGFn37Y+7mKXFk2nSVOW`),abap.operators.concat(new abap.types.String().set(`4h/Pvto729V5Moy6SRxEjjhRb549LGZ554q8v7j15/PTs5+/80U9XwIFpbYC5ywIidKM/OqRf7j3O+Tt9`),abap.operators.concat(new abap.types.String().set(`54QfLjd1/LNBUNbXbbDVfvsXHopsnW33/J2D5ZSOKcwInzv/0yl+bSI/fIWFilyGe+ODXT8BY6RaXZbzC`),abap.operators.concat(new abap.types.String().set(`QP3j3xOTYEw9OjmwcnGmDu2+9dvo32oJZVqUHZLXpEu+/86qM75PWEjcJDDLdmm4t/Oxh2e8SI6WXtomH`),abap.operators.concat(new abap.types.String().set(`77x+8unpk3N5sWqp+GW0YSuJIwKD3FK8/oqMtaxCZGaQT069Pdl46MaVdMCq4J39+7ZB5aniSjMxz1Lc4`),abap.operators.concat(new abap.types.String().set(`4cPyJgIYYmjAk+5/+DMtVtinW8t1LZiv0pcWn0AoRLqOah8rZTAxFDaE5/YfHIvdnCJWwn8P2wfSIvMY7`),abap.operators.concat(new abap.types.String().set(`h+U8vhfpQ4t+wfuuO66eys0qgBruKA/TVlRA7FlJnyG1TiRQQGKzG/r7vIV4rEVpxE04wJPo2KaYMfGIN`),abap.operators.concat(new abap.types.String().set(`JHNnH5vASw9xeeWur9+u3dE/JafvMl6enP5dO1YkmiZlh0v0ntLk6Ijalo17pZ/JU8W3w9VIxidw+ONI+`),abap.operators.concat(new abap.types.String().set(`Xn4VE8VvO2AQibkmU2JFURJD2+s3dUj0IMlLz25MT86+cRJcFSFlTr6cxPw9d4J/bfNoUWbScm2l0ia4S`),abap.operators.concat(new abap.types.String().set(`yXOp6VsFZ8OSgip3je9p88P1B73xWOHZayH/SvpUx72mWq7hK2L3QNHyL2HJyvxhW+/klJFyUnM774sYm`),abap.operators.concat(new abap.types.String().set(`2MZefkm3PxFiSi41QjKBBS5aM6ojQoEkio8mt7+md5telzElN/ylTPLAxqmx+ouMgs3ET0rl0NohKdJWa`),abap.operators.concat(new abap.types.String().set(`pv3zfASlWhJzEama9/Oi9MzEWJb2FmUQ1AA121y3XyGdq5ivNJk34xs4NLJZkdZUHDBibB3nm6h/FDozc`),abap.operators.concat(new abap.types.String().set(`+9kyF4Vy1F4bVivxLiz9i4qck3jm+m13oJQOjpGthO9oGtMu8Wr/xbJm84BcJ5M/A4UGzQ0YhG3KK20Dg`),abap.operators.concat(new abap.types.String().set(`Popmf0embhnjjwwFwe2XrkYu0qoOiGVLa8rqq2tiMz61EPF0R48s0TPDEWJYVGRsxIHiQgMdCCdkWZeNX`),abap.operators.concat(new abap.types.String().set(`p9g6nOo9F8HHnbAQG5bQLpbV6pTsBzv2xTz1IepTg1CFUcpPqr56oduqDaUPWHiutSl0aJYRGRu0gcFTh`),abap.operators.concat(new abap.types.String().set(`KpMGiHQBq6czF5lBSRSVWceDjbKzKpyQOg440Tdi6RNtQxQ0uMbQRmbiZLcNzT8k4Rd8CQ6TBoh0A6pSd`),abap.operators.concat(new abap.types.String().set(`i81BvM/DCtE2DngvH5v2xWoFKYmjylXY9157iSEq8pyIwUNiF4HZP/HFFBqNkzmn+ESkwdpIrDqYrYeKJ`),abap.operators.concat(new abap.types.String().set(`V/iIX1LDNTNh5JTlaXiQEmc3kG9H/g8Ern9vyflD9E2VHFLkxgiIp//89xcutI1GiwqMHs+pPWNUmIIie`),abap.operators.concat(new abap.types.String().set(`l0G8MMGLmisyg5VVkqDkoSM8j9M8hdsTFzkxaU0OkgZtNE21DFLVViaBKZO+aZNMzEhWu0LgI33ZmqW4A`),abap.operators.concat(new abap.types.String().set(`hJLaxpXtT4ACq9tVKTlWWigMlsY31NzmgDomeqHTRNozmF2UhiaEkMsLyfBrbwzVajtxVjZ9dfExXidWV`),abap.operators.concat(new abap.types.String().set(`lo1VA4fn9qYjKmc0DtTAsG2h9vJcD/obGE9UumgbRvOLsrDE0DQjl2Zf6CIwKJlUB/uYLh1Ah/s4sOX6Z`),abap.operators.concat(new abap.types.String().set(`8hl84C+JUZWHwc2JrelYDUriazaZt9IDJE9sqKrwMCL+8awn1KB6lzVYHJW3+1cP6vnDjxJAiW5/zAkl0`),abap.operators.concat(new abap.types.String().set(`9UYg6I9oMAylTbKnXYVLMxkF6VD31LrAZTZEXI0VliaCtyHwJDbnnkm2KQO/DRYT4vJUuC+NyNAvhDnYp`),abap.operators.concat(new abap.types.String().set(`BPOpEObl8/ACEUr3STQfvrJ6r/KbCi+1OgrqRJ+XyBafceyuJ1Vkgt+f2cUA7Uy7QXr5dc/QiMURF7ktg`),abap.operators.concat(new abap.types.String().set(`aPslG4+dqUqylOCwZGdFUCtEG3ivrvXKXflBk8gRrMSRfvBCRtpIrWCK3iSGJpH7FDjR1Bl0ptoqgO0It`),abap.operators.concat(new abap.types.String().set(`b9u6hwEVkuwWlYtpCPvXEcibspLSdz0zjxvWpp5Tt7qxiJCUx09tq2hqY0Sqn09vUoMOZGHEBjoDEa57w`),abap.operators.concat(new abap.types.String().set(`ykTMsp+1oa0WOXOn5Wz0jrBacsyvQzsIXG97JxwLPpGFy2zETTTEze4OtF/sQ3CWwhlvKol7rdSFAvYoj`),abap.operators.concat(new abap.types.String().set(`1+acBWUJtK9Q7AO1GvD+P5OhdYkDk9EV3hB5K4GXTRo6+yEmsYvtkFe+6aJmDSDxla2v6/Qn16V0lzqok`),abap.operators.concat(new abap.types.String().set(`HhPDSVzphSpxM1XiNYa9s/ofvfTPpqtY8teRKvGaombgHCr9lUSVeE2pEsepEq8p7HsROYJKfyVRJa6Mn`),new abap.types.String().set(`ipxZfRUiSujp0pcGT1V4sroqRJXRk+VuDJytif/Aa8ZlmVpfNVQAAAAAElFTkSuQmCC`))))))))))))))))))))))))))))))))))})));
  }
  async #given_cds_metadata() {
    await this.#given_file({iv_file: abap.operators.concat(new abap.types.String().set(`{`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"BASEINFO":`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`{`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"FROM":`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`[`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"T100"`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`],`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"ASSOCIATED":`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`[],`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"BASE":`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`[],`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"ANNO_REF":`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`[],`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`"VERSION":0`),abap.operators.concat(ltcl_is_binary.gv_nl,abap.operators.concat(new abap.types.String().set(`}`),abap.operators.concat(ltcl_is_binary.gv_nl,new abap.types.String().set(`}`)))))))))))))))))))))))))))))))});
  }
  async #given_cds_view_with_umlaut() {
    let lc_umlaut_ue = new abap.types.XString({qualifiedName: "XSTRING"});
    lc_umlaut_ue.set(`C3BC`);
    await this.#given_file({iv_file: abap.operators.concat(new abap.types.String().set(`@EndUserText.label: `),abap.operators.concat((await abap.Classes['ZCL_ABAPGIT_CONVERT'].xstring_to_string_utf8({iv_data: lc_umlaut_ue})),abap.operators.concat(new abap.types.String().set(`bernahmekandidat'`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`@AbapCatalog.sqlViewName: 'ZTESTDDLSBUG2'`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`@AbapCatalog.compiler.compareFilter: true`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`@AbapCatalog.preserveKey: true`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`@AccessControl.authorizationCheck: #CHECK`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`define view ztest_ddls_bug2`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`  as select from t100`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`{`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`  key sprsl as Sprsl,`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`  key arbgb as Arbgb,`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`  key msgnr as Msgnr,`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,abap.operators.concat(new abap.types.String().set(`      text  as Text`),abap.operators.concat(ltcl_is_binary.gv_cr_lf,new abap.types.String().set(`}`)))))))))))))))))))))))))))});
  }
  async #when_is_binary_determined() {
    this.#mv_act_is_binary.set((await abap.Classes['ZCL_ABAPGIT_UTILS'].is_binary({iv_data: this.#mv_given_file})));
  }
  async #then_is_not_binary() {
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: this.#mv_act_is_binary, exp: abap.builtin.abap_false});
  }
  async #then_is_binary() {
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: this.#mv_act_is_binary, exp: abap.builtin.abap_true});
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_UTILS-LTCL_IS_BINARY'] = ltcl_is_binary;
ltcl_is_binary.gv_nl = new abap.types.Character(1, {});
ltcl_is_binary.gv_cr_lf = new abap.types.Character(2, {});
await ltcl_is_binary.class_constructor();
export {ltcl_is_binary};