<commit_before>var assert = require('assert');
var steam = require('./app');

//forgetting to pass in apiKey
assert.throws(function() {
  var q = new steam(); 
}, Error, 'Incorrect construction did not throw error');
//passing in somethign that isn't a string as an apiKey
assert.throws(function() {
  var q = new steam({
    apiKey: ['asdf', 'asdf'],
    format: 'json'
  }); 
}, Error, 'Incorrect apiKey data type did not throw error');

//invalid format
assert.throws(function() {
  var q = new steam({
    apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
    format: 'qwe'
  }); 
}, Error, 'Incorrect format did not throw error');
//invalid format data type
assert.throws(function() {
  var q = new steam({
    apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
    format: ['qwe', 'asdf']
  }); 
}, Error, 'Incorrect format data type did not throw error');


var s = new steam({
  apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
});
//invalid getNewsForApp
assert.throws(function() {
  s.getNewsForApp({
    count: 3,
    maxlength: 300,
    callback: function(data) {
    }
  })
}, Error, 'Incorrect appid to getNewsForApp did not throw error');
assert.throws(function() {
  s.getNewsForApp({
    appid: 400,
    maxlength: 300,
    callback: function(data) {
    }
  })
}, Error, 'Incorrect count to getNewsForApp did not throw error');
assert.throws(function() {
  s.getNewsForApp({
    appid: 400,
    count: 300,
    callback: function(data) {
    }
  })
}, Error, 'Incorrect maxlength to getNewsForApp did not throw error');

//invalid getGlobalAchievementPercentagesForApp
assert.throws(function() {
  s.getGlobalAchievementPercentagesForApp({
    callback: function(data) {
    }
  })
}, Error, 'Incorrect gameid to getGlobalAchievementPercentagesForApp did not throw error');

//invalid getPlayerSummaries
assert.throws(function() {
  s.getPlayerSummaries({
    callback: function(data) {
    }
  })
}, Error, 'Incorrect steamids to getGlobalAchievementPercentagesForApp did not throw error');
assert.throws(function() {
  s.getPlayerSummaries({
    callback: function(data) {
    },
    steamids: {}
  })
}, Error, 'Incorrect steamids to getGlobalAchievementPercentagesForApp did not throw error');

//invalid getSchema
assert.throws(function() {
  s.getSchema({
    callback: function(data) {
    },
    gameid: []
  })
}, Error, 'Incorrect gameid to getSchema did not throw error');

//invalid getPlayerItems
assert.throws(function() {
  s.getPlayerItems({
    callback: function(data) {
    },
    gameid: [],
    steamid: '76561197960435530'
  })
}, Error, 'Incorrect gameid to getPlayerItems did not throw error');
assert.throws(function() {
  s.getPlayerItems({
    callback: function(data) {
    },
    gameid: 440,
    steamid: ['']
  })
}, Error, 'Incorrect steamid to getPlayerItems did not throw error');


/*Correctly implimented*/
assert.doesNotThrow(function() {
  var s = new steam({
    apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
  });
  s.getNewsForApp({
    appid: 440,
    count: 3,
    maxlength: 300,
    callback: function(data) {
      assert.ok(data, 'No data returned from getNewsForApp');
    }
  })
  s.getGlobalAchievementPercentagesForApp({
    callback: function(data) {
      assert.ok(data, 'No data returned for getGlobalAchievementPercentagesForApp');<commit_msg>removed eronious construction in test<commit_after>var assert = require('assert');
var steam = require('./app');

//forgetting to pass in apiKey
assert.throws(function() {
  var q = new steam(); 
}, Error, 'Incorrect construction did not throw error');
//passing in somethign that isn't a string as an apiKey
assert.throws(function() {
  var q = new steam({
    apiKey: ['asdf', 'asdf'],
    format: 'json'
  }); 
}, Error, 'Incorrect apiKey data type did not throw error');

//invalid format
assert.throws(function() {
  var q = new steam({
    apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
    format: 'qwe'
  }); 
}, Error, 'Incorrect format did not throw error');
//invalid format data type
assert.throws(function() {
  var q = new steam({
    apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
    format: ['qwe', 'asdf']
  }); 
}, Error, 'Incorrect format data type did not throw error');


var s = new steam({
  apiKey: '9FE25C516BE06DE9CBA1511C6EF0F1AD',
});
//invalid getNewsForApp
assert.throws(function() {
  s.getNewsForApp({
    count: 3,
    maxlength: 300,
    callback: function(data) {
    }
  })
}, Error, 'Incorrect appid to getNewsForApp did not throw error');
assert.throws(function() {
  s.getNewsForApp({
    appid: 400,
    maxlength: 300,
    callback: function(data) {
    }
  })
}, Error, 'Incorrect count to getNewsForApp did not throw error');
assert.throws(function() {
  s.getNewsForApp({
    appid: 400,
    count: 300,
    callback: function(data) {
    }
  })
}, Error, 'Incorrect maxlength to getNewsForApp did not throw error');

//invalid getGlobalAchievementPercentagesForApp
assert.throws(function() {
  s.getGlobalAchievementPercentagesForApp({
    callback: function(data) {
    }
  })
}, Error, 'Incorrect gameid to getGlobalAchievementPercentagesForApp did not throw error');

//invalid getPlayerSummaries
assert.throws(function() {
  s.getPlayerSummaries({
    callback: function(data) {
    }
  })
}, Error, 'Incorrect steamids to getGlobalAchievementPercentagesForApp did not throw error');
assert.throws(function() {
  s.getPlayerSummaries({
    callback: function(data) {
    },
    steamids: {}
  })
}, Error, 'Incorrect steamids to getGlobalAchievementPercentagesForApp did not throw error');

//invalid getSchema
assert.throws(function() {
  s.getSchema({
    callback: function(data) {
    },
    gameid: []
  })
}, Error, 'Incorrect gameid to getSchema did not throw error');

//invalid getPlayerItems
assert.throws(function() {
  s.getPlayerItems({
    callback: function(data) {
    },
    gameid: [],
    steamid: '76561197960435530'
  })
}, Error, 'Incorrect gameid to getPlayerItems did not throw error');
assert.throws(function() {
  s.getPlayerItems({
    callback: function(data) {
    },
    gameid: 440,
    steamid: ['']
  })
}, Error, 'Incorrect steamid to getPlayerItems did not throw error');


/*Correctly implimented*/
assert.doesNotThrow(function() {
  s.getNewsForApp({
    appid: 440,
    count: 3,
    maxlength: 300,
    callback: function(data) {
      assert.ok(data, 'No data returned from getNewsForApp');
    }
  })
  s.getGlobalAchievementPercentagesForApp({
    callback: function(data) {
      assert.ok(data, 'No data returned for getGlobalAchievementPercentagesForApp');
{'fraction_non_alphanumeric': 0.13206970345460103, 'fraction_numerical': 0.03026597370834607, 'mean_word_length': 3.983244478293983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5050722', 'n_tokens_mistral': 2275, 'n_tokens_neox': 2151, 'n_words': 555}