Skip to content

Commit 135b4dc

Browse files
authored
Merge pull request #421 from scratchfoundation/fixes-for-gui
Fix [email protected] for browser builds
2 parents 0537bda + dff5d46 commit 135b4dc

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/LLK/scratch-storage.git"
1010
},
1111
"main": "./dist/node/scratch-storage.js",
12-
"browser": "./src/index.js",
12+
"browser": "./dist/web/scratch-storage.js",
1313
"scripts": {
1414
"build": "webpack --progress --colors --bail",
1515
"coverage": "tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",

test/unit/load-default-assets.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
const md5 = require('js-md5');
22

3-
const ScratchStorage = require('../../src/index.js');
3+
const ScratchStorage = require('../../dist/node/scratch-storage');
4+
5+
// Hash and file size of each default asset
6+
const knownSizes = {
7+
'8e768a5a5a01891b05c01c9ca15eb6aa': 255,
8+
'b586745b98e94d7574f7f7b48d831e20': 46,
9+
'e5cb3b2aa4e1a9b4c735c3415e507e66': 925
10+
};
411

512
const getDefaultAssetTypes = storage => {
613
const defaultAssetTypes = [storage.AssetType.ImageBitmap, storage.AssetType.ImageVector, storage.AssetType.Sound];
@@ -42,6 +49,7 @@ test('load', () => {
4249
expect(asset.assetId).toStrictEqual(id);
4350
expect(asset.assetType).toStrictEqual(assetType);
4451
expect(asset.data.length).toBeTruthy();
52+
expect(asset.data.length).toBe(knownSizes[id]);
4553
expect(md5(asset.data)).toBe(id);
4654
};
4755
for (const assetType of defaultAssetTypes) {

0 commit comments

Comments
 (0)