@@ -85,9 +85,9 @@ function abstractPersistence (opts) {
8585 throw new Error ( 'no instance' )
8686 }
8787
88- async function matchRetainedWithPattern ( t , pattern ) {
88+ async function matchRetainedWithPattern ( t , pattern , opts ) {
8989 const prInstance = await persistence ( t )
90- const packet = await storeRetainedPacket ( prInstance )
90+ const packet = await storeRetainedPacket ( prInstance , opts )
9191 let stream
9292 if ( Array . isArray ( pattern ) ) {
9393 stream = prInstance . createRetainedStreamCombi ( pattern )
@@ -122,11 +122,31 @@ function abstractPersistence (opts) {
122122 await matchRetainedWithPattern ( t , 'hello/+' )
123123 } )
124124
125+ test ( 'look up retained messages with a + as first element' , async t => {
126+ t . plan ( 1 )
127+ await matchRetainedWithPattern ( t , '+/world' )
128+ } )
129+
130+ test ( 'look up retained messages with +/#' , async t => {
131+ t . plan ( 1 )
132+ await matchRetainedWithPattern ( t , '+/#' )
133+ } )
134+
135+ test ( 'look up retained messages with a + and # pattern with some in between' , async t => {
136+ t . plan ( 1 )
137+ await matchRetainedWithPattern ( t , 'hello/+/world/#' , { topic : 'hello/there/world/creatures' } )
138+ } )
139+
125140 test ( 'look up retained messages with multiple patterns' , async t => {
126141 t . plan ( 1 )
127142 await matchRetainedWithPattern ( t , [ 'hello/+' , 'other/hello' ] )
128143 } )
129144
145+ test ( 'look up retained messages with multiple wildcard patterns' , async t => {
146+ t . plan ( 1 )
147+ await matchRetainedWithPattern ( t , [ 'hello/+' , 'hel/#' , 'hello/world/there/+' ] )
148+ } )
149+
130150 test ( 'store multiple retained messages in order' , async ( t ) => {
131151 t . plan ( 1000 )
132152 const prInstance = await persistence ( t )
0 commit comments