77const { createId : cuid } = require ( '@paralleldrive/cuid2' ) ;
88
99let conn = null ;
10- const testStreamId = 'str-' + cuid ( ) . slice ( 0 , 8 ) ;
11- const childStreamId = 'str-child-' + cuid ( ) . slice ( 0 , 8 ) ;
10+ const suffix = cuid ( ) . slice ( 0 , 8 ) ;
11+ const testStreamId = 'str-' + suffix ;
12+ const childStreamId = 'str-child-' + suffix ;
13+ const testStreamName = 'Test Stream ' + suffix ;
14+ const childStreamName = 'Child Stream ' + suffix ;
1215
1316describe ( '[STRX] Streams' , ( ) => {
1417 before ( async function ( ) {
@@ -21,18 +24,18 @@ describe('[STRX] Streams', () => {
2124 it ( '[SCRA] create a root stream' , async ( ) => {
2225 const res = await conn . api ( [ {
2326 method : 'streams.create' ,
24- params : { id : testStreamId , name : 'Test Stream' }
27+ params : { id : testStreamId , name : testStreamName }
2528 } ] ) ;
2629 expect ( res [ 0 ] ) . to . exist ;
2730 expect ( res [ 0 ] . stream ) . to . exist ;
2831 expect ( res [ 0 ] . stream . id ) . to . equal ( testStreamId ) ;
29- expect ( res [ 0 ] . stream . name ) . to . equal ( 'Test Stream' ) ;
32+ expect ( res [ 0 ] . stream . name ) . to . equal ( testStreamName ) ;
3033 } ) ;
3134
3235 it ( '[SCRB] create a child stream' , async ( ) => {
3336 const res = await conn . api ( [ {
3437 method : 'streams.create' ,
35- params : { id : childStreamId , name : 'Child Stream' , parentId : testStreamId }
38+ params : { id : childStreamId , name : childStreamName , parentId : testStreamId }
3639 } ] ) ;
3740 expect ( res [ 0 ] ) . to . exist ;
3841 expect ( res [ 0 ] . stream ) . to . exist ;
@@ -42,7 +45,7 @@ describe('[STRX] Streams', () => {
4245 it ( '[SCRC] reject duplicate stream id' , async ( ) => {
4346 const res = await conn . api ( [ {
4447 method : 'streams.create' ,
45- params : { id : testStreamId , name : 'Duplicate' }
48+ params : { id : testStreamId , name : 'Duplicate ' + suffix }
4649 } ] ) ;
4750 expect ( res [ 0 ] ) . to . exist ;
4851 expect ( res [ 0 ] . error ) . to . exist ;
@@ -80,11 +83,11 @@ describe('[STRX] Streams', () => {
8083 it ( '[SUPA] rename a stream' , async ( ) => {
8184 const res = await conn . api ( [ {
8285 method : 'streams.update' ,
83- params : { id : childStreamId , update : { name : 'Renamed Child' } }
86+ params : { id : childStreamId , update : { name : 'Renamed ' + suffix } }
8487 } ] ) ;
8588 expect ( res [ 0 ] ) . to . exist ;
8689 expect ( res [ 0 ] . stream ) . to . exist ;
87- expect ( res [ 0 ] . stream . name ) . to . equal ( 'Renamed Child' ) ;
90+ expect ( res [ 0 ] . stream . name ) . to . equal ( 'Renamed ' + suffix ) ;
8891 } ) ;
8992 } ) ;
9093
0 commit comments