   [gutterContainerComponent] = []
   mockGutterContainer = {}
 
-  buildTestState = (sortedDescriptions) ->
-    mockTestState =
-      gutters:
-        scrollHeight: 100
-        scrollTop: 10
-        backgroundColor: 'black'
-        sortedDescriptions: sortedDescriptions
-        customDecorations: {}
-        lineNumberGutter:
-          maxLineNumberDigits: 10
-          lineNumbers: {}
+  buildTestState = (gutters) ->
+    styles =
+      scrollHeight: 100
+      scrollTop: 10
+      backgroundColor: 'black'
+
+    mockTestState = {gutters: []}
+    for gutter in gutters
+      if gutter.name is 'line-number'
+        content = {maxLineNumberDigits: 10, lineNumbers: {}}
+      else
+        content = {}
+      mockTestState.gutters.push({gutter, styles, content, visible: gutter.visible})
+
     mockTestState
 
   beforeEach ->


  describe "when updated with state that contains a new gutter that is not visible", ->
    it "creates the gutter view but hides it, and unhides it when it is later updated to be visible", ->
      customGutter = new Gutter(mockGutterContainer, {name: 'custom'})
      testState = buildTestState([{gutter: customGutter, visible: false}])

      gutterContainerComponent.updateSync(testState)
      expect(gutterContainerComponent.getDomNode().children.length).toBe 1
      expectedCustomGutterNode = gutterContainerComponent.getDomNode().children.item(0)
      expect(expectedCustomGutterNode.style.display).toBe 'none'

      testState = buildTestState([{gutter: customGutter, visible: true}])
      gutterContainerComponent.updateSync(testState)
      expect(gutterContainerComponent.getDomNode().children.length).toBe 1
      expectedCustomGutterNode = gutterContainerComponent.getDomNode().children.item(0)

  describe "when updated with a gutter that already exists", ->
    it "reuses the existing gutter view, instead of recreating it", ->
      customGutter = new Gutter(mockGutterContainer, {name: 'custom'})
      testState = buildTestState([customGutter])

      gutterContainerComponent.updateSync(testState)
      expect(gutterContainerComponent.getDomNode().children.length).toBe 1
      expectedCustomGutterNode = gutterContainerComponent.getDomNode().children.item(0)

      testState = buildTestState([customGutter])
      gutterContainerComponent.updateSync(testState)
      expect(gutterContainerComponent.getDomNode().children.length).toBe 1
      expect(gutterContainerComponent.getDomNode().children.item(0)).toBe expectedCustomGutterNode

  it "removes a gutter from the DOM if it does not appear in the latest state update", ->
    lineNumberGutter = new Gutter(mockGutterContainer, {name: 'line-number'})
    testState = buildTestState([lineNumberGutter])
    gutterContainerComponent.updateSync(testState)

    expect(gutterContainerComponent.getDomNode().children.length).toBe 1
