Skip to content

Commit

Permalink
[lgao&stlei] #14 Refine expect string to regex expression
Browse files Browse the repository at this point in the history
  • Loading branch information
devtrac committed Apr 12, 2012
1 parent b57fdec commit 39c1f61
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -129,23 +129,23 @@ describe("ActionItemUpload", function() {
actionItems.push(SiteMother.createActionItem('YES one', false));
actionItems.push(SiteMother.createActionItem('YES two', false));
devtrac.actionItemUpload.uploadMultiple(actionItems, siteID, placeID, progressCallback, successCallback, errorCallback);
expect(successCallback).toHaveBeenCalledWith('Action item Uploading finished. 0 failure in 2 items.');
expect(successCallback.mostRecentCall.args).toMatch(new RegExp("0 failure in 2"));
})

it("'errorCallback' should be called when some of all action items uploaded successfully", function() {
actionItems.push(SiteMother.createActionItem('YES one', false));
actionItems.push(SiteMother.createActionItem('FAILED one', false));
actionItems.push(SiteMother.createActionItem('YES two', false));
devtrac.actionItemUpload.uploadMultiple(actionItems, siteID, placeID, progressCallback, successCallback, errorCallback);
expect(errorCallback).toHaveBeenCalledWith('Action item Uploading finished. 1 failure in 3 items.');
expect(errorCallback.mostRecentCall.args).toMatch(new RegExp("1 failure in 3"));
})

it("'errorCallback' should be called when all action items uploaded failed", function() {
actionItems.push(SiteMother.createActionItem('FAILED one', false));
actionItems.push(SiteMother.createActionItem('FAILED two', false));
actionItems.push(SiteMother.createActionItem('FAILED three', false));
devtrac.actionItemUpload.uploadMultiple(actionItems, siteID, placeID, progressCallback, successCallback, errorCallback);
expect(errorCallback).toHaveBeenCalledWith('Action item Uploading finished. 3 failure in 3 items.');
expect(errorCallback.mostRecentCall.args).toMatch(new RegExp("3 failure in 3"));
})
})

Expand Down

0 comments on commit 39c1f61

Please sign in to comment.