JamieMason/syncpack

View on GitHub
src/bin-lint-semver-ranges/list-semver-group-mismatches.spec.ts

Summary

Maintainability
C
1 day
Test Coverage
import 'expect-more-jest';
import { listSemverGroupMismatches } from './list-semver-group-mismatches';

describe('listSemverGroupMismatches', () => {
  describe('when semver range should be "~"', () => {
    it('returns dependencies with invalid semver ranges', () => {
      expect(
        listSemverGroupMismatches({
          range: '~',
          instances: [
            { name: 'foo', version: '~0.1.4' },
            { name: 'bar', version: '2.2.6' },
            { name: 'baz', version: '^1.0.0' },
          ],
        } as any),
      ).toEqual([
        { name: 'bar', version: '2.2.6' },
        { name: 'baz', version: '^1.0.0' },
      ]);
    });
  });
  describe('when semver range should be ""', () => {
    it('returns dependencies with invalid semver ranges', () => {
      expect(
        listSemverGroupMismatches({
          range: '',
          instances: [
            { name: 'foo', version: '~0.1.4' },
            { name: 'bar', version: '2.2.6' },
            { name: 'baz', version: '^1.0.0' },
          ],
        } as any),
      ).toEqual([
        { name: 'baz', version: '^1.0.0' },
        { name: 'foo', version: '~0.1.4' },
      ]);
    });
  });
});