default-project.test.js 995 B

123456789101112131415161718192021
  1. import defaultProjectGenerator from '../../../src/lib/default-project/index.js';
  2. describe('defaultProject', () => {
  3. // This test ensures that the assets referenced in the default project JSON
  4. // do not get out of sync with the raw assets that are included alongside.
  5. // see https://github.com/LLK/scratch-gui/issues/4844
  6. test('assets referenced by the project are included', () => {
  7. const translatorFn = () => '';
  8. const defaultProject = defaultProjectGenerator(translatorFn);
  9. const includedAssetIds = defaultProject.map(obj => obj.id);
  10. const projectData = JSON.parse(defaultProject[0].data);
  11. projectData.targets.forEach(target => {
  12. target.costumes.forEach(costume => {
  13. expect(includedAssetIds.includes(costume.assetId)).toBe(true);
  14. });
  15. target.sounds.forEach(sound => {
  16. expect(includedAssetIds.includes(sound.assetId)).toBe(true);
  17. });
  18. });
  19. });
  20. });