"use strict";

var _react = require("@testing-library/react");
var _useToast = require("./useToast");
afterEach(() => {
  jest.useRealTimers();
});
test('utilise le type erreur par defaut', () => {
  const _renderHook = (0, _react.renderHook)(() => (0, _useToast.useToast)()),
    result = _renderHook.result;
  (0, _react.act)(() => {
    result.current.showToast('Erreur');
  });
  expect(result.current.toastType).toBe('error');
});
test('affiche puis masque automatiquement le toast', () => {
  jest.useFakeTimers();
  const _renderHook2 = (0, _react.renderHook)(() => (0, _useToast.useToast)(3000)),
    result = _renderHook2.result;
  (0, _react.act)(() => {
    result.current.showToast('Message de test', 'success');
  });
  expect(result.current.toastMessage).toBe('Message de test');
  expect(result.current.toastType).toBe('success');
  (0, _react.act)(() => {
    jest.advanceTimersByTime(3000);
  });
  expect(result.current.toastMessage).toBe('');
});