Skip to content

Commit

Permalink
Fixing bogus files
Browse files Browse the repository at this point in the history
  • Loading branch information
SkylerNgC committed May 7, 2014
1 parent ac63665 commit 48daddb
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 241 deletions.
78 changes: 39 additions & 39 deletions Tests/System/addnote.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// Tests for use cases at the notes route
var notes = require('../../models/notes');
var users = require('../../models/users');
var zombie = require('zombie');
var browser = new zombie();

// Empty the database
exports['setup'] = function(test) {
notes.deleteAll(function() {
test.done();
});
};

exports['log in (success)'] = function(test) {
test.expect(2);
console.log('hello');
browser.visit('http://localhost:8082/', function() {
test.ok(browser.query('#login'));
console.log('hey');
browser.
fill('#login_name', 'username').
fill('#login_password', 'password').
pressButton('#login_submit', function() {
test.ok(browser.query('#logout'));
browser.clickLink('#logout', function() {
test.done();
});
});
});
}

// Empty the database and close the connection
exports['cleanup'] = function(test) {
notes.deleteAll(function() {
notes.close(function() {
test.done();
});
});
};
// Tests for use cases at the notes route
var notes = require('../../models/notes');
var users = require('../../models/users');
var zombie = require('zombie');
var browser = new zombie();

// Empty the database
exports['setup'] = function(test) {
notes.deleteAll(function() {
test.done();
});
};

exports['log in (success)'] = function(test) {
test.expect(2);
console.log('hello');
browser.visit('http://localhost:8082/', function() {
test.ok(browser.query('#login'));
console.log('hey');
browser.
fill('#login_name', 'username').
fill('#login_password', 'password').
pressButton('#login_submit', function() {
test.ok(browser.query('#logout'));
browser.clickLink('#logout', function() {
test.done();
});
});
});
}

// Empty the database and close the connection
exports['cleanup'] = function(test) {
notes.deleteAll(function() {
notes.close(function() {
test.done();
});
});
};
152 changes: 76 additions & 76 deletions Tests/Unit/users.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
// Skyler Ng
// Unit tests for the users collections

// This is to get to the database code in the folder models
var users = require('../../models/users');

// Before testing user collection, we want to put it in a known state
// First test is always a setup test

// Empty the database
// 'test' is the callback in the deleteAll function in /models/users.js
exports['setup'] = function(test) {
users.deleteAll(function() {
// At the end of all tests, need to call test.done()
// Thiw will tell it that it did so the task successfully
// And will then move on to the next tests
test.done();
});
};

// Successful registration
exports['register a user'] = function(test) {
// When using test.ok(), tell it how many to expect so that it doesn't end abruptly
// and claim that it's ok
test.expect(1);
users.create('username', 'password', function(success) {
// Checks if success is true
test.ok(success);
test.done();
});
};

// Unsuccessful login
exports['register a duplicate user'] = function(test) {
test.expect(1);
users.create('username', 'password', function(success) {
test.ok(!success);
test.done();
});
};

// Successful login
exports['login a user'] = function(test) {
test.expect(1);
users.retrieve('username', 'password', function(success) {
test.ok(success);
test.done();
});
};

// Unsuccessful login
exports['login with bad username'] = function(test) {
test.expect(1);
users.retrieve('badusername', 'password', function(success) {
test.ok(!success);
test.done();
});
};

// Unsuccessful login
exports['login with bad password'] = function(test) {
test.expect(1);
users.retrieve('username', 'badpassword', function(success) {
test.ok(!success);
test.done();
});
};

// Empty the database and close the connection to database
exports['cleanup'] = function(test) {
users.deleteAll(function() {
users.close(function() {
test.done();
});
});
};
// Skyler Ng
// Unit tests for the users collections

// This is to get to the database code in the folder models
var users = require('../../models/users');

// Before testing user collection, we want to put it in a known state
// First test is always a setup test

// Empty the database
// 'test' is the callback in the deleteAll function in /models/users.js
exports['setup'] = function(test) {
users.deleteAll(function() {
// At the end of all tests, need to call test.done()
// Thiw will tell it that it did so the task successfully
// And will then move on to the next tests
test.done();
});
};

// Successful registration
exports['register a user'] = function(test) {
// When using test.ok(), tell it how many to expect so that it doesn't end abruptly
// and claim that it's ok
test.expect(1);
users.create('username', 'password', function(success) {
// Checks if success is true
test.ok(success);
test.done();
});
};

// Unsuccessful login
exports['register a duplicate user'] = function(test) {
test.expect(1);
users.create('username', 'password', function(success) {
test.ok(!success);
test.done();
});
};

// Successful login
exports['login a user'] = function(test) {
test.expect(1);
users.retrieve('username', 'password', function(success) {
test.ok(success);
test.done();
});
};

// Unsuccessful login
exports['login with bad username'] = function(test) {
test.expect(1);
users.retrieve('badusername', 'password', function(success) {
test.ok(!success);
test.done();
});
};

// Unsuccessful login
exports['login with bad password'] = function(test) {
test.expect(1);
users.retrieve('username', 'badpassword', function(success) {
test.ok(!success);
test.done();
});
};

// Empty the database and close the connection to database
exports['cleanup'] = function(test) {
users.deleteAll(function() {
users.close(function() {
test.done();
});
});
};
126 changes: 0 additions & 126 deletions Tests/system/index.js

This file was deleted.

0 comments on commit 48daddb

Please sign in to comment.