domjtalbot/nx-mesh

View on GitHub
packages/nx-mesh/src/executors/validate/hasher.spec.ts

Summary

Maintainability
B
6 hrs
Test Coverage
import { Hasher, HasherContext } from '@nrwl/devkit';

import { validateHasher } from './hasher';

describe('validateHasher', () => {
  it('should generate hash', async () => {
    const mockHasher: Hasher = {
      hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }),
    } as unknown as Hasher;
    const hash = await validateHasher(
      {
        id: 'my-task-id',
        target: {
          project: 'proj',
          target: 'target',
        },
        overrides: {},
      },
      {
        hasher: mockHasher,
      } as unknown as HasherContext
    );
    expect(hash).toEqual({ value: 'hashed-task' });
  });
});