<commit_before>// ==========================================================================
// SC.Logger Unit Test
// ==========================================================================

/*globals module test equals */


// Test console needed because testing for null functions,
// ie. setting the actual console.log = null means setting up
// and tearing down no longer work properly.

function testConsole() {
  return {
    log: function() { return true; },
    alert: function() { return true; },
    dir: function() { return true; },
    dirxml: function() { return true; },
    error: function() { return true; },
    group: function() { return true; },
    groupEnd: function() { return true; },
    info: function() { return true; },
    profile: function() { return true; },
    profileEnd: function() { return true; },
    time: function() { return true; },
    timeEnd: function() { return true; },
    trace: function() { return true; },
    warn: function() { return true; }
  };
};

module("SC.Logger", {
  setup: function() {
    SC.Logger.set('reporter', testConsole());
    
    SC.Logger.format = true;
    SC.Logger.fallBackOnLog = true;
    SC.Logger.fallBackOnAlert = false;
  },
  teardown: function() {
  }
});

test("exists", function() {
  equals(SC.Logger.get('exists'), true, "Reporter does exist check");
  
  SC.Logger.set('reporter', null);
  equals(SC.Logger.get('exists'), false, "Reporter does not exist check");
});

test("log", function() {
  equals(SC.Logger.log("test"), true, "Function is defined" );
  
  var reporter = SC.Logger.get('reporter');
  reporter.log = null;
  equals(SC.Logger.log("test"), false, "Function is null");
  
  SC.Logger.fallBackOnAlert = true;
  equals(SC.Logger.log("test"), true, "Function is null -- fallBackOnAlert true");
});
<commit_msg>add unit tests for SC.Logger.debug<commit_after>// ==========================================================================
// SC.Logger Unit Test
// ==========================================================================

/*globals module test equals */


// Test console needed because testing for null functions,
// ie. setting the actual console.log = null means setting up
// and tearing down no longer work properly.

function testConsole() {
  return {
    log: function() { return true; },
    alert: function() { return true; },
    debug: function() { return true; },
    dir: function() { return true; },
    dirxml: function() { return true; },
    error: function() { return true; },
    group: function() { return true; },
    groupEnd: function() { return true; },
    info: function() { return true; },
    profile: function() { return true; },
    profileEnd: function() { return true; },
    time: function() { return true; },
    timeEnd: function() { return true; },
    trace: function() { return true; },
    warn: function() { return true; }
  };
};

module("SC.Logger", {
  setup: function() {
    SC.Logger.set('reporter', testConsole());
    
    SC.Logger.format = true;
    SC.Logger.fallBackOnLog = true;
    SC.Logger.fallBackOnAlert = false;
  },
  teardown: function() {
  }
});

test("exists", function() {
  equals(SC.Logger.get('exists'), true, "Reporter does exist check");
  
  SC.Logger.set('reporter', null);
  equals(SC.Logger.get('exists'), false, "Reporter does not exist check");
});

test("log", function() {
  equals(SC.Logger.log("test"), true, "Function is defined" );
  
  var reporter = SC.Logger.get('reporter');
  reporter.log = null;
  equals(SC.Logger.log("test"), false, "Function is null");
  
  SC.Logger.fallBackOnAlert = true;
  equals(SC.Logger.log("test"), true, "Function is null -- fallBackOnAlert true");
});

test("debug", function() {
  equals(SC.Logger.debug("Debug"), true, "Function is defined");

  SC.Logger.get('reporter').debug = null;
  equals(SC.Logger.debug("Debug"), true, "Function is null -- fallBackOnLog true");

  SC.Logger.fallBackOnLog = false;
  equals(SC.Logger.debug("Debug"), false, "Function is null -- fallBackOnLog false");
});

{'fraction_non_alphanumeric': 0.2314929437979698, 'fraction_numerical': 0.0, 'mean_word_length': 3.891041162227603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5818968', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1151, 'n_words': 327}