import fontsReducer from '../Reducer';
import { ADD_FONT, ADD_FONTS } from '../Actions';

describe('Reducers/DesignView', () => {
    let initialState;
    let stateWithCustomFont;

    beforeAll(() => {
        initialState = fontsReducer();
    });
    test('returns the correct state for ADD_FONT action', () => {
        stateWithCustomFont = fontsReducer(initialState, {
            type: ADD_FONT,
            data: {
                name: 'Calibri',
                family: 'Calibri',
            },
        });

        expect(stateWithCustomFont).toEqual([
            {
                name: 'Calibri',
                family: 'Calibri',
            },
        ]);
    });
    test('returns the correct state for ADD_FONTS action', () => {
        stateWithCustomFont = fontsReducer(initialState, {
            type: ADD_FONTS,
            data: [{ name: 'Calibri', family: 'Calibri' }],
        });

        expect(stateWithCustomFont).toEqual([
            {
                name: 'Calibri',
                family: 'Calibri',
            },
        ]);
    });
});
