All files / output zcl_abapgit_apack_writer.clas.testclasses.mjs

100% Statements 66/66
83.33% Branches 5/6
100% Functions 4/4
100% Lines 66/66

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 661x 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
const {zcl_abapgit_apack_writer} = await import("./zcl_abapgit_apack_writer.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_apack_writer.clas.testclasses.abap
class ltcl_apack_manifest_writer {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_APACK_WRITER-LTCL_APACK_MANIFEST_WRITER';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"THE_SERIALIZATOR": {"visibility": "I", "parameters": {}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "the_serializator": this.#the_serializator.bind(this),
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #the_serializator() {
    let ls_apack_manifest_descriptor = new abap.types.Structure({
    "group_id": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DESCRIPTOR_WO_DEPENDENCIES-GROUP_ID"}),
    "artifact_id": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DESCRIPTOR_WO_DEPENDENCIES-ARTIFACT_ID"}),
    "version": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DESCRIPTOR_WO_DEPENDENCIES-VERSION"}),
    "sem_version": new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {}),
    "repository_type": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_REPOSITORY_TYPE"}),
    "git_url": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DESCRIPTOR_WO_DEPENDENCIES-GIT_URL"}),
    "dependencies": abap.types.TableFactory.construct(new abap.types.Structure({
    "group_id": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DEPENDENCY-GROUP_ID"}),
    "artifact_id": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DEPENDENCY-ARTIFACT_ID"}),
    "version": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DEPENDENCY-VERSION"}),
    "sem_version": new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {}),
    "git_url": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_APACK_DEFINITIONS=>TY_DEPENDENCY-GIT_URL"}),
    "target_package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"})}, "zif_abapgit_apack_definitions=>ty_dependency", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_apack_definitions=>ty_dependencies")}, "zif_abapgit_apack_definitions=>ty_descriptor", undefined, {}, {});
    let lo_manifest_writer = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_APACK_WRITER", RTTIName: "\\CLASS=ZCL_ABAPGIT_APACK_WRITER"});
    let lv_bool = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let lv_actual_xml = new abap.types.String({qualifiedName: "STRING"});
    ls_apack_manifest_descriptor.get().group_id.set(abap.CharacterFactory.get(17, 'github.com/larshp'));
    ls_apack_manifest_descriptor.get().artifact_id.set(abap.CharacterFactory.get(7, 'abapGit'));
    ls_apack_manifest_descriptor.get().version.set(abap.CharacterFactory.get(3, '1.8'));
    ls_apack_manifest_descriptor.get().git_url.set(abap.CharacterFactory.get(37, 'https://github.com/larshp/abapGit.git'));
    lo_manifest_writer.set((await abap.Classes['ZCL_ABAPGIT_APACK_WRITER'].create_instance({is_apack_manifest_descriptor: ls_apack_manifest_descriptor})));
    lv_actual_xml.set((await lo_manifest_writer.get().serialize()));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_not_initial({act: lv_actual_xml});
    lv_bool.set(abap.builtin.boolc(abap.compare.eq(abap.builtin.contains({val: lv_actual_xml, sub: abap.CharacterFactory.get(34, '<ARTIFACT_ID>abapGit</ARTIFACT_ID>')}), abap.builtin.abap_true)));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_bool, exp: abap.builtin.abap_true});
    lv_bool.set(abap.builtin.boolc(abap.compare.eq(abap.builtin.contains({val: lv_actual_xml, sub: abap.CharacterFactory.get(38, '<GROUP_ID>github.com/larshp</GROUP_ID>')}), abap.builtin.abap_true)));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_bool, exp: abap.builtin.abap_true});
    lv_bool.set(abap.builtin.boolc(abap.compare.eq(abap.builtin.contains({val: lv_actual_xml, sub: abap.CharacterFactory.get(42, '<REPOSITORY_TYPE>abapGit</REPOSITORY_TYPE>')}), abap.builtin.abap_true)));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_bool, exp: abap.builtin.abap_true});
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_APACK_WRITER-LTCL_APACK_MANIFEST_WRITER'] = ltcl_apack_manifest_writer;
export {ltcl_apack_manifest_writer};