Skip to content

Commit

Permalink
Add test for #29
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhobbs committed Jun 7, 2021
1 parent 6ef59bd commit b903a64
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/spec/TodoTxtItem-Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,26 @@ describe( "TodoTxtItem", function () {
contexts: [ "work" ],
projects: null
};
target_with_double_at_and_context = {
raw: 'This task has C@@ in it. @work',
render: 'This task has C@@ in it. @work',
text: 'This task has C@@ in it.',
priority: null,
complete: false,
completed: null,
date: null,
contexts: [ "work" ],
projects: null
};

describe( "when given a context bound task", TodoTxtItemHelper( target ) );

describe( "when given a leading context bound task", TodoTxtItemHelper( leading_target ) );

describe( "when given a task containing @ and a context", TodoTxtItemHelper( target_with_at_and_context ) );

describe( "when given a task containing double @ and a context", TodoTxtItemHelper( target_with_double_at_and_context ) );

var invalid = [
// Whitespace is required in front of the context
{ raw: "This is not a context john@example.com", text: "This is not a context john@example.com" }
Expand Down
13 changes: 13 additions & 0 deletions test/spec/TodoTxtItem-Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ describe( "TodoTxtItem", function () {
contexts: null,
projects: [ "Manhattan" ]
};
target_with_plus_plus_and_project = {
raw: 'This task uses C++ in it. +project',
render: 'This task uses C++ in it. +project',
text: 'This task uses C++ in it.',
priority: null,
complete: false,
completed: null,
date: null,
contexts: null,
projects: [ 'project' ]
};

var invalid = [
// Spaces are not allowed between the + and the project
Expand All @@ -47,6 +58,8 @@ describe( "TodoTxtItem", function () {

describe( "when given a task containing + and a project", TodoTxtItemHelper( target_with_plus_and_project ) );

describe( "when given a task containing ++ and a project", TodoTxtItemHelper( target_with_plus_plus_and_project ) );

describe( "when given an invalid project string", function () {
it( "should not parse it", function () {
var item;
Expand Down

0 comments on commit b903a64

Please sign in to comment.