Skip to content

Commit

Permalink
test(fix-mismatches): clarify behaviour with non-semver mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Jan 29, 2021
1 parent 640cb7f commit 4fd1d0a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
22 changes: 19 additions & 3 deletions src/commands/__snapshots__/fix-mismatches.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`fixMismatches ignores non-semver dependencies 1`] = `
exports[`fixMismatches when dependencies are installed with different versions replaces non-semver dependencies with valid semver dependencies 1`] = `
Array [
Object {
"contents": Object {
"dependencies": Object {
"foo": "link:vendor/foo-0.1.0",
"foo": "0.3.0",
},
},
"filePath": "/a/package.json",
},
Object {
"contents": Object {
"dependencies": Object {
"foo": "link:vendor/foo-0.2.0",
"foo": "0.3.0",
},
},
"filePath": "/b/package.json",
},
Object {
"contents": Object {
"dependencies": Object {
"foo": "0.3.0",
},
},
"filePath": "/c/package.json",
},
Object {
"contents": Object {
"dependencies": Object {
"foo": "0.3.0",
},
},
"filePath": "/d/package.json",
},
]
`;

Expand Down
18 changes: 10 additions & 8 deletions src/commands/fix-mismatches.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ describe('fixMismatches', () => {
expect(wrappers).toMatchSnapshot();
});
});
});

it('ignores non-semver dependencies', () => {
const wrappers = [
mock.wrapper('a', ['foo@link:vendor/foo-0.1.0']),
mock.wrapper('b', ['foo@link:vendor/foo-0.2.0']),
];
fixMismatches(wrappers, DEFAULT_CONFIG);
expect(wrappers).toMatchSnapshot();
it('replaces non-semver dependencies with valid semver dependencies', () => {
const wrappers = [
mock.wrapper('a', ['foo@link:vendor/foo-0.1.0']),
mock.wrapper('b', ['foo@link:vendor/foo-0.2.0']),
mock.wrapper('c', ['foo@0.3.0']),
mock.wrapper('d', ['foo@0.2.0']),
];
fixMismatches(wrappers, DEFAULT_CONFIG);
expect(wrappers).toMatchSnapshot();
});
});
});

0 comments on commit 4fd1d0a

Please sign in to comment.