This commit is contained in:
Matthew Riley MacPherson 2015-10-08 22:27:05 +01:00
Родитель 99756ba7bd
Коммит c32cde989b
3 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -17,7 +17,7 @@ function validRDF(contents) {
</RDF>`;
}
describe('RDF Checker', function() {
describe('RDF', function() {
it('should not warn when we validate a good RDF file', () => {
var contents = fs.readFileSync('tests/example.rdf', 'utf8');

Просмотреть файл

@ -112,15 +112,26 @@ describe('Validator', function() {
});
});
// Test to make sure we can all JS files inside an add-on, not just one.
it('should scan all JS files', () => {
// Test to make sure we can all files inside an add-on, not just one of each.
//
// Uses our test XPI, with the following file layout:
//
// - chrome.manifest
// - chrome/
// - components/
// - main.js (has a mozIndexedDB assignment)
// - secondary.js (nothing bad)
// - install.rdf
it('should scan all files', () => {
var addonValidator = new Validator({_: ['tests/example.xpi']});
var getFileSpy = sinon.spy(addonValidator, 'scanFile');
return addonValidator.scan()
.then(() => {
assert.ok(getFileSpy.calledTwice);
assert.ok(getFileSpy.calledWith('components/main.js'));
assert.ok(getFileSpy.calledWith('components/secondary.js'));
assert.ok(getFileSpy.calledWith('install.rdf'));
});
});

Просмотреть файл

@ -4,7 +4,7 @@ import * as messages from 'messages';
import { singleLineString } from 'utils';
describe('JS Code Checker', function() {
describe('JavaScript', function() {
it('should not allow mozIndexedDB', () => {
var code = 'var myDatabase = indexeddb || mozIndexedDB;';