<commit_before><commit_msg>Added unit test for test checking data macro explanations (issue #210)<commit_after>const {ERROR, WARNING, url, runTests} = require("./testutils");

exports["test doc dataMacroExplanation"] = function testDataMacroExplanation(assert, done) {
  const tests = [
    {
      str: '<p>{{nondatamacro}}</p>' +
           '<p class="hidden">The data is maintained at <a href="https://domain/path/to/data"></a></p><p>{{compat}}</p>' +
           '<p class="hidden">The data is maintained at <a href="https://domain/path/to/data"></a></p><p>{{css_ref}}</p>' +
           '<p class="hidden">The data is maintained at <a href="https://domain/path/to/data"></a></p><p>{{cssanimatedproperties}}</p>' +
           '<p class="hidden">The data is maintained at <a href="https://domain/path/to/data"></a></p><p>{{cssinfo}}</p>' +
           '<p class="hidden">The data is maintained at <a href="https://domain/path/to/data"></a></p><p>{{csssyntax}}</p>' +
           '<p class="hidden">The data is maintained at <a href="https://domain/path/to/data"></a></p><p>{{WebExtBrowserCompat}}</p>' +
           '<p>{{Compat}}</p>' +
           '<p class="hidden">The data is maintained somewhere else.</p><p>{{Compat}}</p>',
      expected: [
        {
          msg: "data_macro_explanation_missing",
          msgParams: ["{{Compat}}"],
          type: ERROR
        },
        {
          msg: "data_macro_source_link_missing",
          msgParams: ["{{Compat}}"],
          type: ERROR
        }
      ]
    }
  ];

  runTests(assert, done, "dataMacroExplanation", "data macro explanation", url, tests);
};

require("sdk/test").run(exports);
{'fraction_non_alphanumeric': 0.2111650485436893, 'fraction_numerical': 0.0018203883495145632, 'mean_word_length': 3.1328320802005014, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 6, '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': '5432328', 'n_tokens_mistral': 524, 'n_tokens_neox': 501, 'n_words': 104}