Skip to content
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ ./runserver <port>
where port is a positive integer > 1023. To run the server on a different
environment, use

$ node js/dispatcher.js <node>
$ node js/dispatcher.js <port>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a note saying you must be in the CourseProject/src directory?


To interact with the server with your internet browser, browse host:port
where host is the hostname of the machine you are running the server
Expand Down
2 changes: 1 addition & 1 deletion src/js/createDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ db.open(dbLocation, function (error) {

console.log("comment table created.");
});

});


10 changes: 10 additions & 0 deletions src/node_modules/SQLiteHelper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h1>This is a placeholder for the main page</h1>
<a href="addtask.html">Add Task page</a>
</p>


<p>
<a href="veryDynamic/index.html">Example dynamic page request, using jquery</a>
</p>
Expand Down
43 changes: 43 additions & 0 deletions src/tests/comments/commentstest_nodeunit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var path = require('path');
var fs = require('fs');
var basepath = require('basepath').mainpath;
var sqlite = require(basepath + 'lib/node-sqlite/sqlite');
var slh = require('SQLiteHelper');
var dbLocation = (basepath + 'db/main.db');
var task = require('task');


exports.CommentsTest = {
'Test That Comments Can Be Added': function (test) {
test.expect(1);

var succeeded = false;

slh.addComment("testcomment", commentsTaskid, "test@test.com",
function (rtv) {
if (rtv.status == 0) {
succeeded = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're only testing if addComment reports a success. Can we also test that the comment was actually added? By querying the database and verifying it is actually there?


}

test.ok(succeeded, "Adding comments failed!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this line. It says the tesk succeeded, but then the string says it failed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeremy, that string is what's shown if succeeded != true, so this is correct.

test.done();
});
},

'Test That Comments Can Be Removed': function (test) {
test.expect(1);

var succeeded = false;
slh.removeComments(commentsTaskid,
function (rtv) {
if (rtv.status == 0) {
succeeded = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as line 19


}

test.ok(succeeded, "Removing comments failed!");
test.done();
});
},
};
8 changes: 8 additions & 0 deletions src/tests/comments/commentstest_nodeunit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

cd ..
cd ..
node js/createDatabase.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the right way to initialize the database now is using the initbuild.sh script located in the base directory. But it might be broken right now (there is a pull request open for it) so if it seems to not work properly don't worry about it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working right now. Mitchell was trying to test for the existence of the db folder instead of main.db, but in my tests of his new initbuild, it resulted in the same bug that we had encountered while testing for main.db's existence.


node tests/nodeunit/bin/nodeunit tests/comments/commentstest_nodeunit.js