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>`; </RDF>`;
} }
describe('RDF Checker', function() { describe('RDF', function() {
it('should not warn when we validate a good RDF file', () => { it('should not warn when we validate a good RDF file', () => {
var contents = fs.readFileSync('tests/example.rdf', 'utf8'); 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. // Test to make sure we can all files inside an add-on, not just one of each.
it('should scan all JS files', () => { //
// 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 addonValidator = new Validator({_: ['tests/example.xpi']});
var getFileSpy = sinon.spy(addonValidator, 'scanFile'); var getFileSpy = sinon.spy(addonValidator, 'scanFile');
return addonValidator.scan() return addonValidator.scan()
.then(() => { .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'; import { singleLineString } from 'utils';
describe('JS Code Checker', function() { describe('JavaScript', function() {
it('should not allow mozIndexedDB', () => { it('should not allow mozIndexedDB', () => {
var code = 'var myDatabase = indexeddb || mozIndexedDB;'; var code = 'var myDatabase = indexeddb || mozIndexedDB;';