       in1.post new noflo.IP 'data', 'one', scope: 'x'
       in1.post new noflo.IP 'closeBracket', 1, scope: 'x'
 
-  describe 'Process API with unscoped port and scopes', ->
+  describe 'Process API with unscoped inport and scopes', ->
     c = null
     in1 = null
     in2 = null

      loader.registerComponent 'process', 'Async', processAsync
      loader.registerComponent 'process', 'Merge', processMerge
      loader.registerComponent 'process', 'MergeA', processMergeA
      loader.registerComponent 'process', 'MergeUnscoped', processMergeUnscoped
      done()


      in1.post new noflo.IP 'data', 'one', scope: 'x'
      in1.post new noflo.IP 'closeBracket', 1, scope: 'x'

  describe 'Process API with unscoped outport and scopes', ->
    c = null
    in1 = null
    in2 = null
    out = null
    before (done) ->
      fbpData = "
      INPORT=Pc1.IN:IN1
      INPORT=Pc2.IN:IN2
      OUTPORT=PcMerge.OUT:OUT
      Pc1(process/Unscope) -> IN1 PcMerge(process/Merge)
      Pc2(process/Unscope) -> IN2 PcMerge
      "
      noflo.graph.loadFBP fbpData, (err, g) ->
        return done err if err
        loader.registerComponent 'scope', 'MergeUnscopedOut', g
        loader.load 'scope/MergeUnscopedOut', (err, instance) ->
          return done err if err
          c = instance
          in1 = noflo.internalSocket.createSocket()
          c.inPorts.in1.attach in1
          in2 = noflo.internalSocket.createSocket()
          c.inPorts.in2.attach in2
          done()
    beforeEach ->
      out = noflo.internalSocket.createSocket()
      c.outPorts.out.attach out
    afterEach ->
      c.outPorts.out.detach out
      out = null
    it 'should remove scopes as expected', (done) ->
      expected = [
        'null < 1'
        'null DATA 1onePc1:2twoPc2:PcMerge'
        'null >'
      ]
      received = []
      brackets = []

      out.on 'ip', (ip) ->
        switch ip.type
          when 'openBracket'
            received.push "#{ip.scope} < #{ip.data}"
            brackets.push ip.data
          when 'data'
            received.push "#{ip.scope} DATA #{ip.data}"
          when 'closeBracket'
            received.push "#{ip.scope} >"
            brackets.pop()
            return if brackets.length
            chai.expect(received).to.eql expected
            done()

      in1.post new noflo.IP 'openBracket', 1, scope: 'x'
      in1.post new noflo.IP 'data', 'one', scope: 'x'
      in1.post new noflo.IP 'closeBracket', 1, scope: 'x'
      in2.post new noflo.IP 'openBracket', 1, scope: 'y'
      in2.post new noflo.IP 'data', 'two', scope: 'y'
      in2.post new noflo.IP 'closeBracket', 1, scope: 'y'
    it 'should forward packets without scopes', (done) ->
      expected = [
        'null < 1'
        'null DATA 1onePc1:2twoPc2:PcMerge'
        'null >'
      ]
      received = []
      brackets = []

      out.on 'ip', (ip) ->
        switch ip.type
          when 'openBracket'
            received.push "#{ip.scope} < #{ip.data}"
            brackets.push ip.data
          when 'data'
            received.push "#{ip.scope} DATA #{ip.data}"
          when 'closeBracket'
            received.push "#{ip.scope} >"
            brackets.pop()
            return if brackets.length
            chai.expect(received).to.eql expected
            done()
      in1.post new noflo.IP 'openBracket', 1
      in1.post new noflo.IP 'data', 'one'
      in1.post new noflo.IP 'closeBracket'
      in2.post new noflo.IP 'openBracket', 1
      in2.post new noflo.IP 'data', 'two'
      in2.post new noflo.IP 'closeBracket', 1
    it 'should remove scopes also on unscoped packet', (done) ->
      expected = [
        'null < 1'
        'null DATA 1onePc1:2twoPc2:PcMerge'
        'null >'
      ]
      received = []
      brackets = []

      out.on 'ip', (ip) ->
        switch ip.type
          when 'openBracket'
            received.push "#{ip.scope} < #{ip.data}"
            brackets.push ip.data
          when 'data'
            received.push "#{ip.scope} DATA #{ip.data}"
          when 'closeBracket'
            received.push "#{ip.scope} >"
            brackets.pop()
            return if brackets.length
            chai.expect(received).to.eql expected
            done()
      in1.post new noflo.IP 'openBracket', 1, scope: 'x'
      in1.post new noflo.IP 'data', 'one', scope: 'x'
      in1.post new noflo.IP 'closeBracket', 1, scope: 'x'
      in2.post new noflo.IP 'openBracket', 1
      in2.post new noflo.IP 'data', 'two'
      in2.post new noflo.IP 'closeBracket', 1

  describe 'Process API with IIPs to addressable ports and scopes', ->
    c = null
    in1 = null
