-
Couldn't load subscription status.
- Fork 9
Test added. #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Test added. #79
Changes from all commits
d1795e6
ecba0ef
675d1d6
0d35a48
83995fa
b71d15b
55aaff8
d71c78e
df8cc7d
a7c616e
019953f
998ed77
48747d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,7 +89,7 @@ db.open(dbLocation, function (error) { | |
|
|
||
| console.log("comment table created."); | ||
| }); | ||
|
|
||
| }); | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| 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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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!"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as line 19 |
||
|
|
||
| } | ||
|
|
||
| test.ok(succeeded, "Removing comments failed!"); | ||
| test.done(); | ||
| }); | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/sh | ||
|
|
||
| cd .. | ||
| cd .. | ||
| node js/createDatabase.js | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
There was a problem hiding this comment.
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?