mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-07 20:08:54 -04:00
Tests to check whether extensions load (#1700)
This commit is contained in:
parent
6ef600dc2c
commit
5cf10b1af1
13 changed files with 48 additions and 0 deletions
test/integration
27
test/integration/load-extensions.js
Normal file
27
test/integration/load-extensions.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const path = require('path');
|
||||
const test = require('tap').test;
|
||||
const fs = require('fs');
|
||||
const readFileToBuffer = require('../fixtures/readProjectFile').readFileToBuffer;
|
||||
const VirtualMachine = require('../../src/index');
|
||||
|
||||
test('Load external extensions', async t => {
|
||||
const vm = new VirtualMachine();
|
||||
const fileList = fs.readdirSync('./test/fixtures/load-extensions/');
|
||||
const testFiles = fileList.filter(file => path.extname(file) === '.sb2' || path.extname(file) === '.sb3');
|
||||
|
||||
// Test each example extension file
|
||||
for (const file of testFiles) {
|
||||
const ext = file.split('-')[0];
|
||||
const uri = path.resolve(__dirname, `../fixtures/load-extensions/${file}`);
|
||||
const project = readFileToBuffer(uri);
|
||||
|
||||
await t.test('Confirm expected extension is installed in example sb2 projects', extTest => {
|
||||
vm.loadProject(project)
|
||||
.then(() => {
|
||||
extTest.ok(vm.extensionManager.isExtensionLoaded(ext));
|
||||
extTest.end();
|
||||
});
|
||||
});
|
||||
}
|
||||
t.end();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue