/**
 * @format
 */

import React from 'react';
import ReactTestRenderer from 'react-test-renderer';

jest.mock('react-native-device-info', () => ({
  getVersion: () => '1.0.0',
}));

jest.mock('@react-native-async-storage/async-storage', () => ({
  getItem: jest.fn(() => Promise.resolve('zh')),
  setItem: jest.fn(() => Promise.resolve()),
}));

jest.mock('@systemic-games/react-native-bluetooth-le', () => ({
  Central: {
    addListener: jest.fn(),
    removeListener: jest.fn(),
    stopScan: jest.fn(),
    shutdown: jest.fn(),
    initialize: jest.fn(),
    startScan: jest.fn(),
    connectPeripheral: jest.fn(),
    disconnectPeripheral: jest.fn(),
    readCharacteristic: jest.fn(),
    writeCharacteristic: jest.fn(),
    subscribeCharacteristic: jest.fn(),
    unsubscribeCharacteristic: jest.fn(),
  },
}));

jest.mock('@systemic-games/react-native-nordic-nrf5-dfu', () => ({
  startDfu: jest.fn(),
  getDfuTargetId: jest.fn(() => 'mock-device-id'),
  addDfuEventListener: jest.fn(() => ({ remove: jest.fn() })),
}));

jest.mock('react-native-fs', () => ({
  CachesDirectoryPath: '/tmp',
  writeFile: jest.fn(),
  exists: jest.fn(),
  unlink: jest.fn(),
  downloadFile: jest.fn(() => ({ promise: Promise.resolve({ statusCode: 200 }) })),
  stat: jest.fn(),
}));

jest.mock('react-native-vector-icons/MaterialCommunityIcons', () => 'Icon');
jest.mock('../src/SplashScreen', () => 'SplashScreen');

import App from '../App';

test('renders correctly', async () => {
  await ReactTestRenderer.act(() => {
    ReactTestRenderer.create(<App />);
  });
});
