environment_item_spec.js.es6 3.8 KB
Newer Older
F
Filipa Lacerda 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
//= require vue
//= require environments/components/environment_item

describe('Environment item', () => {
  fixture.preload('environments/table.html');
  beforeEach(() => {
    fixture.load('environments/table.html');
  });

  describe('When item is folder', () => {
    let mockItem;
    let component;

    beforeEach(() => {
      mockItem = {
        name: 'review',
        children: [
          {
            name: 'review-app',
            id: 1,
            state: 'available',
            external_url: '',
            last_deployment: {},
            created_at: '2016-11-07T11:11:16.525Z',
            updated_at: '2016-11-10T15:55:58.778Z',
          },
          {
            name: 'production',
            id: 2,
            state: 'available',
            external_url: '',
            last_deployment: {},
            created_at: '2016-11-07T11:11:16.525Z',
            updated_at: '2016-11-10T15:55:58.778Z',
          },
        ],
      };

      component = new window.gl.environmentsList.EnvironmentItem({
        el: document.querySelector('tr#environment-row'),
        propsData: {
          model: mockItem,
          'can-create-deployment': false,
          'can-read-environment': true,
        },
      });
    });

    it('Should render clickable folder icon and name', () => {
      expect(document.querySelector('.folder-name').textContent).toContain(mockItem.name);
      expect(document.querySelector('.folder-icon')).toBeDefined();
    });

    it('Should render the number of children in a badge', () => {
      expect(document.querySelector('.folder-name .badge').textContent).toContain(mockItem.children.length);
    });

    it('Should not render any information other than the name', () => {
    });

    describe('when clicked', () => {
      it('Should render child row', () => {
      });
    });
  });

  describe('when item is not folder', () => {
    it('should render environment name', () => {

    });

    describe('With deployment', () => {
      it('should render deployment internal id', () => {

      });

      it('should link to deployment', () => {

      });

      describe('With user information', () => {
        it('should render user avatar with link to profile', () => {

        });
      });

      describe('With build url', () => {
        it('Should link to build url provided', () => {

        });

        it('Should render deployable name and id', () => {

        });
      });

      describe('With commit information', () => {
        it('should render commit component', () => {});
      });

      it('Should render timeago created date', () => {

      });
    });

    describe('Without deployment', () => {
      it('should render no deployments information', () => {

      });
    });

    describe('With manual actions', () => {
      describe('With create deployment permission', () => {
        it('Should render actions component', () => {

        });
      });
      describe('Without create deployment permission', () => {
        it('should not render actions component', () => {

        });
      });
    });

    describe('With external URL', () => {
      it('should render external url component', () => {

      });
    });

    describe('With stop action', () => {
      describe('With create deployment permission', () => {
        it('Should render stop action component', () => {

        });
      });
      describe('Without create deployment permission', () => {
        it('should not render stop action component', () => {

        });
      });
    });

    describe('With retry action', () => {
      describe('With create deployment permission', () => {
        it('Should render rollback component', () => {

        });
      });
      describe('Without create deployment permission', () => {
        it('should not render rollback component', () => {

        });
      });
    });
  });
});