var vows = require('vows');
var assert = require('assert');
var util = require('util');
var oauth2orize = require('index');
var Server = require('server');


vows.describe('oauth2orize').addBatch({
  
  'should export module function': function () {
    assert.strictEqual(oauth2orize, oauth2orize.createServer);
  },
  
  'should export functions': function () {
    assert.isFunction(oauth2orize.createServer);
  },
  
  'should export grant middleware': function () {
    assert.isObject(oauth2orize.grant);
    assert.isFunction(oauth2orize.grant.code);
    assert.isFunction(oauth2orize.grant.token);
  },
  
  'should export exchange middleware': function () {
    assert.isObject(oauth2orize.exchange);
    assert.isFunction(oauth2orize.exchange.authorizationCode);
    assert.isFunction(oauth2orize.exchange.clientCredentials);
    assert.isFunction(oauth2orize.exchange.password);
    assert.isFunction(oauth2orize.exchange.refreshToken);
  },
  
  'createServer': {
    topic: function() {
      return oauth2orize.createServer();
    },
    
    'should return a Server' : function(s) {
      assert.instanceOf(s, Server);
    },
  },
  
}).export(module);

@@ -595,24 +595,191 @@
 ant.token);%0A
+    %0A    assert.strictEqual(oauth2orize.grant.authorizationCode, oauth2orize.grant.code);%0A    assert.strictEqual(oauth2orize.grant.implicit, oauth2orize.grant.token);%0A
   %7D,%0A  %0A  's
@@ -1104,24 +1104,120 @@
 reshToken);%0A
+    %0A    assert.strictEqual(oauth2orize.exchange.code, oauth2orize.exchange.authorizationCode);%0A
   %7D,%0A  %0A  'c

Test case for grant and exchange aliases.