Skip to content

Commit

Permalink
Mock version in manifest test
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Dec 10, 2024
1 parent 20e7e5a commit ed928eb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/snaps-cli/src/commands/manifest/implementation.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getPlatformVersion } from '@metamask/snaps-utils';
import {
DEFAULT_SNAP_BUNDLE,
DEFAULT_SNAP_ICON,
getMockSnapFilesWithUpdatedChecksum,
getPackageJson,
getSnapManifest,
} from '@metamask/snaps-utils/test-utils';
import type { SemVerVersion } from '@metamask/utils';
import normalFs from 'fs';
import ora from 'ora';

Expand Down Expand Up @@ -33,12 +33,20 @@ jest.mock('../../webpack', () => ({
}),
}));

jest.mock('module', () => ({
createRequire: jest.fn().mockImplementation(() => {
const fn = jest.fn().mockReturnValue({ version: '1.0.0' }) as any;
jest.spyOn(fn, 'resolve').mockImplementation();
return fn;
}),
}));

describe('manifest', () => {
beforeEach(async () => {
const { manifest: newManifest } = await getMockSnapFilesWithUpdatedChecksum(
{
manifest: getSnapManifest({
platformVersion: getPlatformVersion(),
platformVersion: '1.0.0' as SemVerVersion,
}),
},
);
Expand Down Expand Up @@ -164,7 +172,7 @@ describe('manifest', () => {
"url": "https://github.com/MetaMask/example-snap.git"
},
"source": {
"shasum": "xYFUdpKz+yNGb1LwDGRHmqsH1PXknt2tE9ZJr1P0kb4=",
"shasum": "itjh0enng42nO6BxNCEhDH8wm3yl4xlVclfd5LsZ2wA=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand All @@ -179,7 +187,7 @@ describe('manifest', () => {
"chains": ["eip155:1", "eip155:2", "eip155:3"]
}
},
"platformVersion": "6.13.0",
"platformVersion": "1.0.0",
"manifestVersion": "0.1"
}
"
Expand Down

0 comments on commit ed928eb

Please sign in to comment.