<commit_before>QUnit.module("Loader Factory", {
    before: function() {
        console.log("Kickoff: " + Math.random());
    },
    beforeEach: function() {
        console.log("Creating new test object");
        this.image_loader = new ImageLoader_0_5_x();
    }
});


/************************************************************\
 * Set Defaults and Version Number 
\************************************************************/

QUnit.test("Confirm version number", function(assert) {
    var target_version = "0.5.0";
    assert.equal(target_version, this.image_loader.version_number()); 
});

///

QUnit.test("Confirm default for .dpr()", function(assert) {
    var target = 0;
    var result = this.image_loader.dpr(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .percent_of_viewport_width()", function(assert) {
    var target = 94;
    var result = this.image_loader.percent_of_viewport_width(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .source_file_width()", function(assert) {
    var target = 0;
    var result = this.image_loader.source_file_width(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .url_template()", function(assert) {
    var target = "";
    var result = this.image_loader.url_template(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .viewport_height()", function(assert) {
    var target = 0;
    var result = this.image_loader.viewport_height(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .viewport_width()", function(assert) {
    var target = 0;
    var result = this.image_loader.viewport_width(); 
    assert.equal(result, target);
});


/************************************************************\
 * Integration Tests 
\************************************************************/


QUnit.test("Integration Test 1: Base functionality using the minimum setup and call", function(assert) {

    // Preflight
    var target = '<img alt="Photo of Horses" width="640" height="436" src="//res.cloudinary.com/demo/image/upload/w_1280,h_852/horses.jpg">';

    // Given 
    this.image_loader._url_template = '//res.cloudinary.com/demo/image/upload/w_[PHYSICAL_WIDTH],h_[PHYSICAL_HEIGHT]/[FILENAME]';
    
    // When 
    var result =  '<img alt="Photo of Horses" width="640" height="436" src="//res.cloudinary.com/demo/image/upload/w_1280,h_852/horses.jpg">';
    result = this.image_loader.img_tag_string();

//      var result_string = this.image_loader.image_string_from_params( {
//          filename: "horses.jpg", 
//          alt_text: "Photo of Horses",
//          source_file_width: 1600,
//          source_file_height: 1067
//      });
    
    // Then
    assert.equal(target, result);
});


/************************************************************\
 * Unit Tests 
\************************************************************/


});




/******************************************************\
 * DEPRECATED TESTS
 *
 * The tests below are for the prior versoin. They 
 * are being kept temporarirly to make sure new <commit_msg>Added example pseudo-code.<commit_after>QUnit.module("Loader Factory", {
    before: function() {
        console.log("Kickoff: " + Math.random());
    },
    beforeEach: function() {
        console.log("Creating new test object");
        this.image_loader = new ImageLoader_0_5_x();
    }
});


/************************************************************\
 * Set Defaults and Version Number 
\************************************************************/

QUnit.test("Confirm version number", function(assert) {
    var target_version = "0.5.0";
    assert.equal(target_version, this.image_loader.version_number()); 
});

///

QUnit.test("Confirm default for .dpr()", function(assert) {
    var target = 0;
    var result = this.image_loader.dpr(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .percent_of_viewport_width()", function(assert) {
    var target = 94;
    var result = this.image_loader.percent_of_viewport_width(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .source_file_width()", function(assert) {
    var target = 0;
    var result = this.image_loader.source_file_width(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .url_template()", function(assert) {
    var target = "";
    var result = this.image_loader.url_template(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .viewport_height()", function(assert) {
    var target = 0;
    var result = this.image_loader.viewport_height(); 
    assert.equal(result, target);
});

QUnit.test("Confirm default for .viewport_width()", function(assert) {
    var target = 0;
    var result = this.image_loader.viewport_width(); 
    assert.equal(result, target);
});


/************************************************************\
 * Integration Tests 
\************************************************************/


QUnit.test("Integration Test 1: Base functionality using the minimum setup and call", function(assert) {

    // Preflight
    var target = '<img alt="Photo of Horses" width="640" height="436" src="//res.cloudinary.com/demo/image/upload/w_1280,h_852/horses.jpg">';

    // Given 
    this.image_loader._url_template = '//res.cloudinary.com/demo/image/upload/w_[PHYSICAL_WIDTH],h_[PHYSICAL_HEIGHT]/[FILENAME]';
    
    // When 
    var result =  '<img alt="Photo of Horses" width="640" height="436" src="//res.cloudinary.com/demo/image/upload/w_1280,h_852/horses.jpg">';
    result = this.image_loader.img_tag_string();

//      var result_string = this.image_loader.image_string_from_params( {
//          filename: "horses.jpg", 
//          alt_text: "Photo of Horses",
//          source_file_width: 1600,
//          source_file_height: 1067
//      });
    
    // Then
    assert.equal(target, result);
});


/************************************************************\
 * Unit Tests 
\************************************************************/

//     	dpr: 2,
//     	image_name: "horses.jpg",
//       percent_of_viewport_width: 50,
//       quality: 80,
//       raw_height: 1067,
//       raw_width: 1600,
//       viewport_height: 680,
//       viewport_width: 1024,
//       url_template: "http://res.cloudinary.com/demo/image/upload/w_[WIDTH],h_[HEIGHT],q_[QUALITY]/[IMAGE_NAME]"
//
//   assert.equal(imageLoader.url_to_call(), "http://res.cloudinary.com/demo/image/upload/w_1024,h_682,q_80/horses.jpg", "Final URL");
//   assert.equal(imageLoader.render_height(), 341, "Render height");
//   assert.equal(imageLoader.render_width(), 512, "Render width");
//   assert.equal(imageLoader.url_request_height(), 682, "Request height");
//   assert.equal(imageLoader.url_request_width(), 1024, "Request width");
//   assert.equal(imageLoader.img_tag(), '<img src="http://res.cloudinary.com/demo/image/upload/w_1024,h_682,q_80/horses.jpg" width="512" height="341">', "Image tag");

QUnit.test("Unit Test: .logical_width()", function(assert) {
    // Preflight
    var target = 640;

    // Given
//       percent_of_viewport_width: 50,
//       raw_width: 1600,
//       viewport_width: 1024,

    // When
    var result = this.image_loader.logical_width(); 
    assert.equal(result, target);
});




/******************************************************\
 * DEPRECATED TESTS
 *
 * The tests below are for the prior versoin. They 
 * are being kept temporarirly to make sure new 
{'fraction_non_alphanumeric': 0.24830339321357286, 'fraction_numerical': 0.02155688622754491, 'mean_word_length': 3.8303341902313623, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '2134109', 'n_tokens_mistral': 2429, 'n_tokens_neox': 2230, 'n_words': 432}