<commit_before>'use strict';
var fs = require('fs');
var assert = require('assert');
var insights = require('./index');
var key = '<KEY>';

it('should throw if no valid URL is provided', function (done) {
	insights({
		key: key
	}, function(err, data){
	    if(/Invalid url/.test(err)) {
	        return true;
	    }
		done();
	});
});

it('should return desktop results from PageSpeed Insights', function (done) {	
	insights({
		key: key,
		url: 'http://html5rocks.com',
		strategy: 'desktop',
		threshold: 80
	}, function(err, data){
		assert(data.responseCode == 200);
		assert(data.id == 'http://www.html5rocks.com/en/');
		done();
	});
});

it('should return mobile results from PageSpeed Insights', function (done) {
	insights({
		key: key,
		url: 'http://html5rocks.com',
		locale: 'en_GB',
		strategy: 'mobile',
		threshold: 80
	}, function(err, data){
		assert(data.score == 73);
		assert(data.responseCode == 200);
		assert(data.id == 'http://www.html5rocks.com/en/');
		done();
	});
});<commit_msg>Use the nokey option for tests<commit_after>'use strict';
var fs = require('fs');
var assert = require('assert');
var insights = require('./index');

it('should throw if no valid URL is provided', function (done) {
	insights({
		nokey: true
	}, function(err, data){
	    if(/Invalid url/.test(err)) {
	        return true;
	    }
		done();
	});
});

it('should return desktop results from PageSpeed Insights', function (done) {
	insights({
		nokey: true,
		url: 'http://html5rocks.com',
		strategy: 'desktop',
		threshold: 80
	}, function(err, data){
		assert(data.responseCode == 200);
		assert(data.id == 'http://www.html5rocks.com/en/');
		done();
	});
});

it('should return mobile results from PageSpeed Insights', function (done) {
	insights({
		nokey: true,
		url: 'http://html5rocks.com',
		locale: 'en_GB',
		strategy: 'mobile',
		threshold: 80
	}, function(err, data){
		assert(data.score == 73);
		assert(data.responseCode == 200);
		assert(data.id == 'http://www.html5rocks.com/en/');
		done();
	});
});
{'fraction_non_alphanumeric': 0.191699604743083, 'fraction_numerical': 0.015810276679841896, 'mean_word_length': 3.903147699757869, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5535121', 'n_tokens_mistral': 762, 'n_tokens_neox': 693, 'n_words': 178}