 
 
 describe 'Prompt', ->
+  helloSync = ->
+    'Hello, world!'
+
+  # Note: All module methods are handled asynchronously.
+  methods = Impromptu.module.register ->
+    @register 'hello', helloSync
+
+    @register 'echo', (done) ->
+      @exec "printf test", done
+
   sections =
     a:
       content: 'a'

  it 'should assemble a prompt', (done) ->
    prompt = makePrompt ['a', 'b', 'c']
    prompt.build (err, result) ->
      a = '\x1B[44m\x1B[37m a \x1B[0m'
      b = '\x1B[42m\x1B[37m b \x1B[0m'
      c = '\x1B[41m\x1B[39m c \x1B[0m'
      result.should.equal "#{a}#{b}#{c}"
      done()


      content: 'c'
      background: 'red'
      foreground: 'default'
    d:
      content: 'd'
      background: 'red'
      foreground: 'white'
    empty:
      content: ''
      background: 'red'
      foreground: 'white'
    hello:
      content: helloSync
      background: 'blue'
      foreground: 'white'
    echo:
      content: methods.echo
      background: 'blue'
      foreground: 'white'
    multi:
      content: [helloSync, ' | ', methods.echo, ' | ', methods.hello]
      background: 'blue'
      foreground: 'white'


  expect =
    a: '\x1B[44m\x1B[37m a \x1B[0m'
    b: '\x1B[42m\x1B[37m b \x1B[0m'
    c: '\x1B[41m\x1B[39m c \x1B[0m'
    hello: '\x1B[44m\x1B[37m Hello, world! \x1B[0m'
    echo: '\x1B[44m\x1B[37m test \x1B[0m'
    multi: '\x1B[44m\x1B[37m Hello, world! | test | Hello, world! \x1B[0m'

  makePrompt = (keys) ->
    prompt = new Impromptu.Prompt
