// @flow

import { css } from 'styled-components';
import { getThemeSpecificStyles } from './themes.css-rules';
import { themes } from '../../themes';

const mockStyles = css`
  color: 'red';
`;

describe('themes', () => {
  describe('getThemeSpecificStyles', () => {
    it('returns wealthsimple styles when wealthsimple theme is set', () => {
      const expected = mockStyles;
      const actual = getThemeSpecificStyles({
        wealthsimple: mockStyles,
        trade: css``,
      })({ theme: themes.wealthsimple });

      expect(actual).toEqual(expected);
    });

    it('returns trade styles when trade theme is set', () => {
      const expected = mockStyles;
      const actual = getThemeSpecificStyles({
        trade: mockStyles,
        wealthsimple: css``,
      })({ theme: themes.trade });

      expect(actual).toEqual(expected);
    });

    it('returns empower styles when empower theme is set', () => {
      const expected = mockStyles;
      const actual = getThemeSpecificStyles({
        empower: mockStyles,
        wealthsimple: css``,
      })({ theme: themes.empower });

      expect(actual).toEqual(expected);
    });

    it('returns atlas styles when atlas theme is set', () => {
      const expected = mockStyles;
      const actual = getThemeSpecificStyles({
        atlas: mockStyles,
        wealthsimple: css``,
      })({ theme: themes.atlas });

      expect(actual).toEqual(expected);
    });

    it('returns whitelabelDefaults styles when whitelabelDefaults theme is set', () => {
      const expected = mockStyles;
      const actual = getThemeSpecificStyles({
        whitelabelDefaults: mockStyles,
        wealthsimple: css``,
      })({ theme: themes.whitelabelDefaults });

      expect(actual).toEqual(expected);
    });

    it('returns undefined when no style is set for the theme', () => {
      const expected = undefined;
      const actual = getThemeSpecificStyles({
        wealthsimple: css``,
      })({ theme: themes.trade });

      expect(actual).toEqual(expected);
    });
  });
});
