var PWS = require('./lib/wunderground-pws.js');
var chai = require('chai');
chai.should();

var pws = new PWS('TESTING_STATION', 'TESTING_PASSWORD');

describe('Tests for Node.js Weather Underground PWS API library', function(){
  it('should construct an object with valid properties', function(done) {
    pws.should.be.an('object');
    pws.should.have.property('setObservations').that.is.a('function');
    pws.should.have.property('getObservations').that.is.a('function');
    pws.should.have.property('getFields').that.is.a('function');
    pws.should.have.property('sendObservations').that.is.a('function');
    done();
  });
  it('should return an array with every possible observation', function(done) {
    var fields = pws.getFields();
    fields.should.be.an('array');
    done();
  });
  it('should return an object with default mandatory data', function(done) {
    var observations = pws.getObservations();
    observations.should.be.an('object');
    observations.should.have.property('action').that.is.a('string').and.equals('updateraw');
    observations.should.have.property('ID').that.is.a('string').and.equals('TESTING_STATION');
    observations.should.have.property('PASSWORD').that.is.a('string').and.equals('TESTING_PASSWORD');
    observations.should.have.property('dateutc').that.is.a('string').and.equals('now');
    done();
  });
  it('should let the addition of a valid observation', function(done) {
    var fields = pws.getFields();
    fields.forEach(function(field){
      pws.setObservations(field, 'TESTING_VALUE').should.equal(true);
    });
    done();
  });
  it('should not let the addition of an invalid observation', function(done) {
    pws.setObservations('INVALID_FIELD', 'TESTING_VALUE').should.exist.and.be.instanceof(Error).and.have.property('message', 'Observation INVALID_FIELD not supported by WU.');
    done();
  });

  // Pending tests
  it('should let the addition of valid observations from an object');
  it('should not let the addition of invalid observations from an object');
  it('should not let send observations without a timestamp');
  it('should not let send observations without a user name');
  it('should not let send observations without a password');

});

@@ -89,67 +89,8 @@
 );%0A%0A
-var pws = new PWS('TESTING_STATION', 'TESTING_PASSWORD');%0A%0A
 desc
@@ -229,32 +229,57 @@
 unction(done) %7B%0A
+    var pws = new PWS();%0A
     pws.should.b
@@ -663,32 +663,57 @@
 unction(done) %7B%0A
+    var pws = new PWS();%0A
     var fields =
@@ -851,32 +851,94 @@
 unction(done) %7B%0A
+    var pws = new PWS('TESTING_STATION', 'TESTING_PASSWORD');%0A
     var observat
@@ -1468,32 +1468,57 @@
 unction(done) %7B%0A
+    var pws = new PWS();%0A
     var fields =
@@ -1742,24 +1742,49 @@
 ion(done) %7B%0A
+    var pws = new PWS();%0A
     pws.setO
@@ -2182,50 +2182,76 @@
 out 
-a timestamp');%0A  it('should not let 
+credentials', function(done)%7B%0A    var pws = new PWS();%0A    pws.
 send
- o
+O
 bser
@@ -2261,90 +2261,110 @@
 ions
- without a user name');%0A  it('should not let send observations without a password'
+(function(error, result)%7B%0A      error.should.exist.and.be.instanceof(Error);%0A      done();%0A    %7D);%0A  %7D
 );%0A%0A

Add INVALIDPASSWORDID test