<commit_before>describe("Builder", function() {
  var Builder = require('../../src/controllers/builder.js');
  var b;
  var luno = '777';

  beforeEach(function() {
    b = new Builder(luno);
  });

  describe("build()", function(){
    it("should return null on empty message", function() {
      expect(b.build(undefined)).toBeNull();
    });

    it("should build solicited ready status message", function() {
      var object = {
        message_class: 'Solicited',
        message_subclass: 'Status',
        status_descriptor: 'Ready',
      };
      expect(b.build(object)).toEqual('22\x1C777\x1C\x1C9');
    });

    it("should build solicited command reject status message", function() {
      var object = {
        message_class: 'Solicited',
        message_subclass: 'Status',
        status_descriptor: 'Command Reject',
      };
      expect(b.build(object)).toEqual('22\x1C777\x1C\x1CA');
    });

    it("should build solicited specific command reject status message", function() {
      var object = {
        message_class: 'Solicited',
        message_subclass: 'Status',
        status_descriptor: 'Specific Command Reject',
      };
      expect(b.build(object)).toEqual('22\x1C777\x1C\x1CC');
    });

    it("should build Unsolicited Transaction Request message with all data provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1CBA BA BA\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

  });
});<commit_msg>Unsolicited Transaction Request message test cases<commit_after>describe("Builder", function() {
  var Builder = require('../../src/controllers/builder.js');
  var b;
  var luno = '777';

  beforeEach(function() {
    b = new Builder(luno);
  });

  describe("build()", function(){
    it("should return null on empty message", function() {
      expect(b.build(undefined)).toBeNull();
    });

    it("should build solicited ready status message", function() {
      var object = {
        message_class: 'Solicited',
        message_subclass: 'Status',
        status_descriptor: 'Ready',
      };
      expect(b.build(object)).toEqual('22\x1C777\x1C\x1C9');
    });

    it("should build solicited command reject status message", function() {
      var object = {
        message_class: 'Solicited',
        message_subclass: 'Status',
        status_descriptor: 'Command Reject',
      };
      expect(b.build(object)).toEqual('22\x1C777\x1C\x1CA');
    });

    it("should build solicited specific command reject status message", function() {
      var object = {
        message_class: 'Solicited',
        message_subclass: 'Status',
        status_descriptor: 'Specific Command Reject',
      };
      expect(b.build(object)).toEqual('22\x1C777\x1C\x1CC');
    });

    it("should build Unsolicited Transaction Request message with all data provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        track3: ';011234567890123445=724724000000000****00300XXXX020200099010=********************==1=100000000000000000**?*',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C;011234567890123445=724724000000000****00300XXXX020200099010=********************==1=100000000000000000**?*\x1CBA BA BA\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without track2 provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C\x1C\x1CBA BA BA\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without opcode_buffer provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1C\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without amount_buffer provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        opcode_buffer: 'BA BA BA',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1CBA BA BA\x1C\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without PIN_buffer provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        buffer_B: '19671994',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1CBA BA BA\x1C000000001337\x1C\x1C19671994\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without Buufer B provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_C: '1337',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1CBA BA BA\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C\x1C1337\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without Buffer C provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        track1: '%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?',
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1CBA BA BA\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C\x1C%B1234567890123445^PADILLA/L.                ^99011X100000*000000000XXX000000?\x1C');
    });

    it("should build Unsolicited Transaction Request message without Track 1 data provided", function() {
      var object = {
        message_class: 'Unsolicited',
        message_subclass: 'Transaction Request',
        top_of_receipt: '1',
        message_coordination_number: '?',
        track2: ';8990011234567890=20062011987612300720?',
        opcode_buffer: 'BA BA BA',
        amount_buffer: '000000001337',
        PIN_buffer: ';>:>:=>:>:>:>:>:',
        buffer_B: '19671994',
        buffer_C: '1337'
      };
      expect(b.build(object)).toEqual('11\x1C777\x1C\x1C1?\x1C;8990011234567890=20062011987612300720?\x1C\x1CBA BA BA\x1C000000001337\x1C;>:>:=>:>:>:>:>:\x1C19671994\x1C1337\x1C\x1C');
    });

  });
});
{'fraction_non_alphanumeric': 0.15526802218114602, 'fraction_numerical': 0.1961280280182897, 'mean_word_length': 3.2235004108463436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 36, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6623046', 'n_tokens_mistral': 4924, 'n_tokens_neox': 3535, 'n_words': 510}