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

it('should return an array of stylesheet link hrefs', function (done) {
	fs.readFile('test/sample/index.html', function read(err, data) {
		var links = oust(data);
		assert(links.length == 2);
		assert(links[0] == 'bower_components/bootstrap/dist/css/bootstrap.css');
		assert(links[1] == 'styles/main.css');
		done();
	});
});

it('should return an array of refs when passed a HTML string', function (done) {
	var links = oust('<html><link rel="stylesheet" href="styles/main.css"></html>');
	assert(links.length == 1);
	assert(links[0] == 'styles/main.css');
	done();
});

it('should return an array of script srcs', function (done) {
	fs.readFile('test/sample/index.html', function read(err, data) {
		var links = oust(data, 'script');
		assert(links.length == 1);
		assert(links[0] == 'scripts/main.js');
		done();
	});
});

it('should return an array of HTML imports', function (done) {
	fs.readFile('test/imports.html', function read(err, data) {
		var links = oust(data, 'import');
		assert(links.length == 3);
		assert(links[0] == '../polymer/polymer.html');
		assert(links[1] == '../core-ajax/core-ajax.html');
		done();
	});
});

it('should fail if no valid source is specified', function (done) {
	try {
		var links = oust();
	} catch (err) {
		 if(/ReferenceError: src is not defined/.test(err)) {
		 	return true;
		 }
		done();
	}
});<commit_msg>Update tests.<commit_after>'use strict';
var fs = require('fs');
var assert = require('assert');
var oust = require('../index');

it('should return an array of stylesheet link hrefs', function (done) {
	fs.readFile('test/sample/index.html', function read(err, data) {
		var links = oust(data, 'stylesheets');
		assert(links.length == 2);
		assert(links[0] == 'bower_components/bootstrap/dist/css/bootstrap.css');
		assert(links[1] == 'styles/main.css');
		done();
	});
});

it('should return an array of refs when passed a HTML string', function (done) {
	var links = oust('<html><link rel="stylesheet" href="styles/main.css"></html>', 'stylesheets');
	assert(links.length == 1);
	assert(links[0] == 'styles/main.css');
	done();
});

it('should return an array of script srcs', function (done) {
	fs.readFile('test/sample/index.html', function read(err, data) {
		var links = oust(data, 'scripts');
		assert(links.length == 1);
		assert(links[0] == 'scripts/main.js');
		done();
	});
});

it('should return an array of HTML imports', function (done) {
	fs.readFile('test/imports.html', function read(err, data) {
		var links = oust(data, 'imports');
		assert(links.length == 3);
		assert(links[0] == '../polymer/polymer.html');
		assert(links[1] == '../core-ajax/core-ajax.html');
		done();
	});
});

it('should fail if no valid source is specified', function (done) {
	try {
		var links = oust();
	} catch (err) {
		 if(/ReferenceError: src is not defined/.test(err)) {
		 	return true;
		 }
		done();
	}
});

it('should fail if no valid type is specified', function (done) {
		fs.readFile('test/imports.html', function read(err, data) {
			try {
				var links = oust(data);
			} catch (e) {
				 if(/ReferenceError: type is not defined/.test(err)) {
				 	return true;
				 }
				done();				
			}
		});
});
{'fraction_non_alphanumeric': 0.19756468797564689, 'fraction_numerical': 0.0060882800608828, 'mean_word_length': 4.134375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4460487', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1101, 'n_words': 287}