Skip to content

Instantly share code, notes, and snippets.

@dejanvasic85
Created July 24, 2020 00:21
Show Gist options
  • Save dejanvasic85/c3e85479de3a75211271712595f9b949 to your computer and use it in GitHub Desktop.
Save dejanvasic85/c3e85479de3a75211271712595f9b949 to your computer and use it in GitHub Desktop.

Revisions

  1. dejanvasic85 created this gist Jul 24, 2020.
    11 changes: 11 additions & 0 deletions mock.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    import * as dateService from './dateService';

    const nowMock = dateService.now as jest.MockedFunction<typeof dateService.now>;

    describe('some service', () => {
    const mockNow = 'now';

    beforeEach(() => {
    nowMock.mockReturnedValue(mockNow);
    });
    });