Skip to content

Commit ed928eb

Browse files
Mock version in manifest test
1 parent 20e7e5a commit ed928eb

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/snaps-cli/src/commands/manifest/implementation.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { getPlatformVersion } from '@metamask/snaps-utils';
21
import {
32
DEFAULT_SNAP_BUNDLE,
43
DEFAULT_SNAP_ICON,
54
getMockSnapFilesWithUpdatedChecksum,
65
getPackageJson,
76
getSnapManifest,
87
} from '@metamask/snaps-utils/test-utils';
8+
import type { SemVerVersion } from '@metamask/utils';
99
import normalFs from 'fs';
1010
import ora from 'ora';
1111

@@ -33,12 +33,20 @@ jest.mock('../../webpack', () => ({
3333
}),
3434
}));
3535

36+
jest.mock('module', () => ({
37+
createRequire: jest.fn().mockImplementation(() => {
38+
const fn = jest.fn().mockReturnValue({ version: '1.0.0' }) as any;
39+
jest.spyOn(fn, 'resolve').mockImplementation();
40+
return fn;
41+
}),
42+
}));
43+
3644
describe('manifest', () => {
3745
beforeEach(async () => {
3846
const { manifest: newManifest } = await getMockSnapFilesWithUpdatedChecksum(
3947
{
4048
manifest: getSnapManifest({
41-
platformVersion: getPlatformVersion(),
49+
platformVersion: '1.0.0' as SemVerVersion,
4250
}),
4351
},
4452
);
@@ -164,7 +172,7 @@ describe('manifest', () => {
164172
"url": "https://github.com/MetaMask/example-snap.git"
165173
},
166174
"source": {
167-
"shasum": "xYFUdpKz+yNGb1LwDGRHmqsH1PXknt2tE9ZJr1P0kb4=",
175+
"shasum": "itjh0enng42nO6BxNCEhDH8wm3yl4xlVclfd5LsZ2wA=",
168176
"location": {
169177
"npm": {
170178
"filePath": "dist/bundle.js",
@@ -179,7 +187,7 @@ describe('manifest', () => {
179187
"chains": ["eip155:1", "eip155:2", "eip155:3"]
180188
}
181189
},
182-
"platformVersion": "6.13.0",
190+
"platformVersion": "1.0.0",
183191
"manifestVersion": "0.1"
184192
}
185193
"

0 commit comments

Comments
 (0)