@@ -145,6 +145,16 @@ describe('parseCommsUrl', () => {
145145 'https://comms.todoist.com/a/12345/ch/CH1/t/TH1/c/CM1' ,
146146 { workspaceId : 12345 , channelId : 'CH1' , threadId : 'TH1' , commentId : 'CM1' } ,
147147 ] ,
148+ [
149+ 'people URL as workspace-only' ,
150+ 'https://comms.todoist.com/12345/people/u/678' ,
151+ { workspaceId : 12345 } ,
152+ ] ,
153+ ] ) ( 'parses %s' , ( _description , url , expected ) => {
154+ expect ( parseCommsUrl ( url ) ) . toEqual ( expected )
155+ } )
156+
157+ it . each ( [
148158 [
149159 'inbox thread URL' ,
150160 'https://comms.todoist.com/12345/inbox/t/TH1/' ,
@@ -161,14 +171,33 @@ describe('parseCommsUrl', () => {
161171 { workspaceId : 12345 , threadId : 'TH1' } ,
162172 ] ,
163173 [
164- 'people URL as workspace-only ' ,
165- 'https://comms.todoist.com/12345/people/u/678 ' ,
166- { workspaceId : 12345 } ,
174+ 'saved thread with comment URL ' ,
175+ 'https://comms.todoist.com/12345/saved/t/TH1/c/CM1 ' ,
176+ { workspaceId : 12345 , threadId : 'TH1' , commentId : 'CM1' } ,
167177 ] ,
168178 ] ) ( 'parses %s' , ( _description , url , expected ) => {
169179 expect ( parseCommsUrl ( url ) ) . toEqual ( expected )
170180 } )
171181
182+ it . each ( [
183+ [ 'inbox root URL' , 'https://comms.todoist.com/12345/inbox' ] ,
184+ [ 'inbox done URL' , 'https://comms.todoist.com/12345/inbox/done' ] ,
185+ [ 'inbox done thread-like URL' , 'https://comms.todoist.com/12345/inbox/done/t/TH1' ] ,
186+ [ 'missing thread id' , 'https://comms.todoist.com/12345/inbox/t' ] ,
187+ [ 'missing comment id' , 'https://comms.todoist.com/12345/inbox/t/TH1/c' ] ,
188+ [ 'comment-only path' , 'https://comms.todoist.com/12345/inbox/c/CM1' ] ,
189+ [ 'wrong marker after thread id' , 'https://comms.todoist.com/12345/inbox/t/TH1/x/CM1' ] ,
190+ [ 'extra segment after thread id' , 'https://comms.todoist.com/12345/inbox/t/TH1/extra' ] ,
191+ [
192+ 'extra segment after comment id' ,
193+ 'https://comms.todoist.com/12345/inbox/t/TH1/c/CM1/extra' ,
194+ ] ,
195+ [ 'msg suffix after thread id' , 'https://comms.todoist.com/12345/inbox/t/TH1/msg/CV1' ] ,
196+ [ 'saved URL with extra segment' , 'https://comms.todoist.com/12345/saved/t/TH1/extra' ] ,
197+ ] ) ( 'leaves %s workspace-only' , ( _description , url ) => {
198+ expect ( parseCommsUrl ( url ) ) . toEqual ( { workspaceId : 12345 } )
199+ } )
200+
172201 it ( 'parses conversation URL' , ( ) => {
173202 const result = parseCommsUrl ( 'https://comms.todoist.com/a/12345/msg/CV1' )
174203 expect ( result ) . toEqual ( { workspaceId : 12345 , conversationId : 'CV1' } )
@@ -293,6 +322,11 @@ describe('resolveThreadId', () => {
293322 'inbox thread URL with comment suffix' ,
294323 'https://comms.todoist.com/12345/inbox/t/TH1/c/CM1' ,
295324 ] ,
325+ [ 'saved thread URL' , 'https://comms.todoist.com/12345/saved/t/TH1' ] ,
326+ [
327+ 'saved thread URL with comment suffix' ,
328+ 'https://comms.todoist.com/12345/saved/t/TH1/c/CM1' ,
329+ ] ,
296330 ] ) ( 'resolves %s' , ( _description , url ) => {
297331 expect ( resolveThreadId ( url ) ) . toBe ( 'TH1' )
298332 } )
@@ -550,6 +584,8 @@ describe('classifyCommsUrl', () => {
550584 [ 'thread+comment URL' , 'https://comms.todoist.com/a/20/ch/CH1/t/TH1/c/CM1' , 'comment' ] ,
551585 [ 'inbox thread URL' , 'https://comms.todoist.com/20/inbox/t/TH1/' , 'thread' ] ,
552586 [ 'inbox thread+comment URL' , 'https://comms.todoist.com/20/inbox/t/TH1/c/CM1' , 'comment' ] ,
587+ [ 'saved thread URL' , 'https://comms.todoist.com/20/saved/t/TH1' , 'thread' ] ,
588+ [ 'saved thread+comment URL' , 'https://comms.todoist.com/20/saved/t/TH1/c/CM1' , 'comment' ] ,
553589 [ 'conversation URL' , 'https://comms.todoist.com/a/20/msg/CV1' , 'conversation' ] ,
554590 [ 'short conversation URL' , 'https://comms.todoist.com/20/msg/CV1' , 'conversation' ] ,
555591 [ 'message URL' , 'https://comms.todoist.com/a/20/msg/CV1/m/MS1' , 'message' ] ,
@@ -561,6 +597,9 @@ describe('classifyCommsUrl', () => {
561597 [ 'inbox root URL' , 'https://comms.todoist.com/20/inbox' ] ,
562598 [ 'inbox done URL' , 'https://comms.todoist.com/20/inbox/done' ] ,
563599 [ 'inbox done thread-like URL' , 'https://comms.todoist.com/20/inbox/done/t/TH1' ] ,
600+ [ 'inbox thread with extra segment' , 'https://comms.todoist.com/20/inbox/t/TH1/extra' ] ,
601+ [ 'inbox thread with msg suffix' , 'https://comms.todoist.com/20/inbox/t/TH1/msg/CV1' ] ,
602+ [ 'saved thread with extra segment' , 'https://comms.todoist.com/20/saved/t/TH1/extra' ] ,
564603 [ 'workspace-only URL' , 'https://comms.todoist.com/a/20' ] ,
565604 [ 'channel-only URL' , 'https://comms.todoist.com/a/20/ch/CH1' ] ,
566605 [ 'malformed account URL' , 'https://comms.todoist.com/a/ch/CH1/t/TH1' ] ,
0 commit comments