"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var actions = _interopRequireWildcard(require("../tagAssociations"));

var _constants = require("@instructure/quiz-common/lib/constants");

describe('tagAssociations actions creators', function () {
  describe('#addTagAssociation', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.addTagAssociation('Item', '1', {
        id: '1',
        tag_value: '1',
        'tag_id': '1'
      })).to.deep.equal({
        type: _constants.ADD_TAG_ASSOCIATION,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tagAssociation: {
            id: '1',
            tag_value: '1',
            tag_id: '1'
          }
        }
      });
    });
  });
  describe('#removePendingAdditionTagAssociation', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.removePendingAdditionTagAssociation('Item', '1', 'tag-1')).to.deep.equal({
        type: _constants.REMOVE_PENDING_ADDITION_TAG_ASSOCIATION,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tagValue: 'tag-1'
        }
      });
    });
  });
  describe('#removePendingDeletionTagAssociation', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.removePendingDeletionTagAssociation('Item', '1', '1')).to.deep.equal({
        type: _constants.REMOVE_PENDING_DELETION_TAG_ASSOCIATION,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tagAssociationId: '1'
        }
      });
    });
  });
  describe('#removeTagAssociation', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.removeTagAssociation('Item', '1', '2')).to.deep.equal({
        type: _constants.REMOVE_TAG_ASSOCIATION,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tagAssociationId: '2'
        }
      });
    });
  });
  describe('#setPendingAdditionTagAssociations', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.setPendingAdditionTagAssociations('Item', '1', [])).to.deep.equal({
        type: _constants.SET_PENDING_ADDITION_TAG_ASSOCIATIONS,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tags: []
        }
      });
    });
  });
  describe('#setPendingDeletionTagAssociations', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.setPendingDeletionTagAssociations('Item', '1', [])).to.deep.equal({
        type: _constants.SET_PENDING_DELETION_TAG_ASSOCIATIONS,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tags: []
        }
      });
    });
  });
  describe('#setTagInput', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.setTagInput('Item', '1', 'hello')).to.deep.equal({
        type: _constants.SET_TAG_INPUT,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tagInput: 'hello'
        }
      });
    });
  });
  describe('#setTagSuggestions', function () {
    it('returns a well-formed and correct action', function () {
      expect(actions.setTagSuggestions('Item', '1', [], 'stuff')).to.deep.equal({
        type: _constants.SET_TAG_SUGGESTIONS,
        payload: {
          entityType: 'Item',
          entityId: '1',
          tags: [],
          text: 'stuff'
        }
      });
    });
  });
});