Improve scanFile test
This commit is contained in:
Родитель
99756ba7bd
Коммит
c32cde989b
|
@ -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;';
|
||||
|
|
Загрузка…
Ссылка в новой задаче