/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/automatic-mocks/__tests__/createMockFromModule.test.js
16 строк
568 B
Paul O’Shannessy
Update copyrights with Meta Platforms, restore original license in Jasmine fork (#13879)
09 фев 2023, 10:13
Не верифицирован
09 фев 2023, 10:13
6d2632a
Код
Авторство
О чём код?
// Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved. import utils from '../utils'; test('implementation created by automock', () => { expect(utils.authorize('wizard')).toBeUndefined(); expect(utils.isAuthorized()).toBeUndefined(); }); test('implementation created by jest.createMockFromModule', () => { const utils = jest.createMockFromModule('../utils').default; utils.isAuthorized = jest.fn(secret => secret === 'not wizard'); expect(utils.authorize.mock).toBeTruthy(); expect(utils.isAuthorized('not wizard')).toBe(true); });