@@ -585,7 +585,7 @@ describe("Tasks", function () {
585585 expect ( res ) . to . have . status ( 200 ) ;
586586 expect ( res ) . to . have . header (
587587 "X-Deprecation-Warning" ,
588- "WARNING: This endpoint is deprecated and will be removed in the future. Please use /tasks/:userId to get the task details."
588+ "WARNING: This endpoint is deprecated and will be removed in the future. Please use /tasks/:username to get the task details."
589589 ) ;
590590 expect ( res . body ) . to . be . a ( "array" ) ;
591591 expect ( res . body [ 0 ] . status ) . to . equal ( COMPLETED ) ;
@@ -636,7 +636,7 @@ describe("Tasks", function () {
636636 expect ( res ) . to . have . status ( 200 ) ;
637637 expect ( res ) . to . have . header (
638638 "X-Deprecation-Warning" ,
639- "WARNING: This endpoint is deprecated and will be removed in the future. Please use /tasks/:userId to get the task details."
639+ "WARNING: This endpoint is deprecated and will be removed in the future. Please use /tasks/:username to get the task details."
640640 ) ;
641641 expect ( res . body ) . to . be . a ( "array" ) ;
642642 expect ( [ taskId1 , taskId2 ] ) . to . include ( taskId1 ) ;
@@ -1699,117 +1699,4 @@ describe("Tasks", function () {
16991699 expect ( res . body . message ) . to . be . equal ( INTERNAL_SERVER_ERROR ) ;
17001700 } ) ;
17011701 } ) ;
1702-
1703- describe ( "GET /tasks/:userId" , function ( ) {
1704- it ( "Should return all the completed tasks of the user when query 'completed','dev'is true and version is 'v1'" , async function ( ) {
1705- const { userId : assignedUser } = await userModel . addOrUpdate ( {
1706- github_id : "prakashchoudhary07" ,
1707- username : "user1" ,
1708- } ) ;
1709-
1710- const assignedTask = [
1711- {
1712- title : "Test task" ,
1713- type : "feature" ,
1714- endsOn : 1234 ,
1715- startedOn : 4567 ,
1716- status : "COMPLETED" ,
1717- percentCompleted : 10 ,
1718- participants : [ ] ,
1719- assignee : "user1" ,
1720- completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
1721- lossRate : { [ DINERO ] : 1 } ,
1722- isNoteworthy : true ,
1723- } ,
1724- {
1725- title : "Test task" ,
1726- type : "feature" ,
1727- endsOn : 1234 ,
1728- startedOn : 4567 ,
1729- status : "COMPLETED" ,
1730- percentCompleted : 10 ,
1731- participants : [ ] ,
1732- assignee : "user1" ,
1733- completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
1734- lossRate : { [ DINERO ] : 1 } ,
1735- isNoteworthy : true ,
1736- } ,
1737- ] ;
1738- await tasks . updateTask ( assignedTask [ 0 ] ) ;
1739- await tasks . updateTask ( assignedTask [ 1 ] ) ;
1740-
1741- const res = await chai
1742- . request ( app )
1743- . get ( `/tasks/${ assignedUser } /?dev=true&completed=true&version=v1` )
1744- . set ( "cookie" , `${ cookieName } =${ authService . generateAuthToken ( { userId : assignedUser } ) } ` ) ;
1745-
1746- expect ( res ) . to . have . status ( 200 ) ;
1747- expect ( res . body ) . to . be . a ( "array" ) ;
1748- expect ( res . body ) . to . satisfy ( ( tasks ) => tasks . every ( ( task ) => task . status === "COMPLETED" ) ) ;
1749- } ) ;
1750-
1751- it ( "Should return all the tasks of the user when dev is true and version is v1" , async function ( ) {
1752- const { userId : assignedUser } = await userModel . addOrUpdate ( {
1753- github_id : "prakashchoudhary07" ,
1754- username : "user1" ,
1755- } ) ;
1756-
1757- const assignedTask = [
1758- {
1759- title : "Test task" ,
1760- type : "feature" ,
1761- endsOn : 1234 ,
1762- startedOn : 4567 ,
1763- status : "IN_PROGRESS" ,
1764- percentCompleted : 10 ,
1765- participants : [ ] ,
1766- assignee : "user1" ,
1767- completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
1768- lossRate : { [ DINERO ] : 1 } ,
1769- isNoteworthy : true ,
1770- } ,
1771- {
1772- title : "Test task" ,
1773- type : "feature" ,
1774- endsOn : 1234 ,
1775- startedOn : 4567 ,
1776- status : "BLOCKED" ,
1777- percentCompleted : 10 ,
1778- participants : [ ] ,
1779- assignee : "user1" ,
1780- completionAward : { [ DINERO ] : 3 , [ NEELAM ] : 300 } ,
1781- lossRate : { [ DINERO ] : 1 } ,
1782- isNoteworthy : true ,
1783- } ,
1784- ] ;
1785- const { taskId : taskId1 } = await tasks . updateTask ( assignedTask [ 0 ] ) ;
1786- const { taskId : taskId2 } = await tasks . updateTask ( assignedTask [ 1 ] ) ;
1787-
1788- const res = await chai
1789- . request ( app )
1790- . get ( `/tasks/${ assignedUser } /?dev=true&version=v1` )
1791- . set ( "cookie" , `${ cookieName } =${ authService . generateAuthToken ( { userId : assignedUser } ) } ` ) ;
1792-
1793- expect ( res ) . to . have . status ( 200 ) ;
1794- expect ( res . body ) . to . be . a ( "array" ) ;
1795- expect ( [ taskId1 , taskId2 ] ) . to . include ( taskId1 ) ;
1796- } ) ;
1797-
1798- it ( "Should return 401 if not logged in" , async function ( ) {
1799- const { userId : assignedUser } = await userModel . addOrUpdate ( {
1800- github_id : "prakashchoudhary07" ,
1801- username : "user1" ,
1802- } ) ;
1803-
1804- const res = await chai . request ( app ) . get ( `/tasks/${ assignedUser } /?dev=true&version=v1` ) ;
1805-
1806- expect ( res ) . to . have . status ( 401 ) ;
1807- expect ( res . body ) . to . be . an ( "object" ) ;
1808- expect ( res . body ) . to . eql ( {
1809- statusCode : 401 ,
1810- error : "Unauthorized" ,
1811- message : "Unauthenticated User" ,
1812- } ) ;
1813- } ) ;
1814- } ) ;
18151702} ) ;
0 commit comments