       e.which = 100 # 'd'
       $expiry.trigger(e)
 
-      assert.equal $expiry.val(), '1'
+      setTimeout ->
+        assert.equal $expiry.val(), '1'
+        done()

      assert.equal($.payment.cardType('6216657720782466507'), 'unionpay')

  describe 'formatCardNumber', ->
    it 'should format cc number correctly', ->
      $number = $('<input type=text>').payment('formatCardNumber')
      $number.val('4242')


      e.which = 52 # '4'
      $number.trigger(e)

      setTimeout ->
        assert.equal $number.val(), '4242 4'
        done()

  describe 'formatCardExpiry', ->
    it 'should format month shorthand correctly', (done) ->
      $expiry = $('<input type=text>').payment('formatCardExpiry')

      e = $.Event('keypress');
      e.which = 52 # '4'
      $expiry.trigger(e)

      setTimeout ->
        assert.equal $expiry.val(), '04 / '
        done()

    it 'should format forward slash shorthand correctly', (done) ->
      $expiry = $('<input type=text>').payment('formatCardExpiry')
      $expiry.val('1')

