Permalink
Browse files

fixed tests

  • Loading branch information...
1 parent 5434b15 commit eaeef5050896eeb7323ae96611e6703a137ffd2d @kmpm committed Jan 19, 2013
Showing with 20 additions and 12 deletions.
  1. +3 −0 package.json
  2. +13 −12 test/base-test.js
  3. +4 −0 test/test-config.json
View
@@ -13,5 +13,8 @@
"repository":{
"type" : "git",
"url" : "http://github.com/kmpm/node-mcquery.git"
+ },
+ "devDependencies": {
+ "vows": "*"
}
}
View
@@ -1,16 +1,17 @@
/*!
- * Copyright © 2011 Peter Magnusson.
+ * Copyright © 2011-2012 Peter Magnusson.
* All rights reserved.
*/
var vows = require('vows'),
assert = require('assert');
-var Query = require('../mcquery');
+var Query = require('../mcquery')
+ , config = require(__dirname + '/test-config.json');
var query = new Query();
-var TEST_HOST='localhost';
-var TEST_PORT=25565;
+var TEST_HOST=config.server;
+var TEST_PORT=config.port;
vows.describe('GS4 Query').addBatch({
'startSession':{
@@ -27,11 +28,11 @@ vows.describe('GS4 Query').addBatch({
topic:function(session){
return session;
},
- 'has sessionToken':function(session){
- assert.include(session, 'sessionToken');
- assert.isNumber(session.sessionToken);
+ 'has challengeToken':function(session){
+ assert.include(session, 'challengeToken');
+ assert.isNumber(session.challengeToken);
//have never seen a lower value tan 20000
- assert.isTrue(session.sessionToken>20000);
+ assert.isTrue(session.challengeToken>20000);
},
'has host':function(session){
assert.include(session, 'host');
@@ -43,9 +44,9 @@ vows.describe('GS4 Query').addBatch({
assert.isNumber(session.port);
assert.equal(session.port, TEST_PORT);
},
- 'has idToken':function(session){
- assert.include(session, 'idToken');
- assert.isNumber(session.idToken);
+ 'has sessionToken':function(session){
+ assert.include(session, 'sessionToken');
+ assert.isNumber(session.sessionToken);
}
},//topic session object
'basic_stat':{
@@ -57,7 +58,7 @@ vows.describe('GS4 Query').addBatch({
},
'returns a stat object':function(err, stat){
assert.isObject(stat);
- assert.include(stat, 'hostname');
+ assert.include(stat, 'MOTD');
assert.include(stat, 'gametype');
assert.include(stat, 'map');
assert.include(stat, 'numplayers');
@@ -0,0 +1,4 @@
+{
+ "server":"127.0.0.1",
+ "port": 25565
+}

0 comments on commit eaeef50

Please sign in to comment.