@@ -17,7 +17,7 @@ test('cache property gets added to instance', async (t) => {
1717} )
1818
1919test ( 'cache is usable' , async ( t ) => {
20- t . plan ( 3 )
20+ t . plan ( 4 )
2121
2222 const fastify = Fastify ( )
2323 await fastify . register ( async ( instance , options ) => {
@@ -32,16 +32,17 @@ test('cache is usable', async (t) => {
3232 } )
3333
3434 fastify . get ( '/one' , ( req , reply ) => {
35- fastify . cache . set ( 'one' , { one : true } , 100 , ( err ) => {
35+ fastify . cache . set ( 'one' , { one : true } , 1000 , ( err ) => {
3636 if ( err ) return reply . send ( err )
3737 reply . redirect ( '/two' )
3838 } )
3939 } )
4040
4141 fastify . get ( '/two' , ( req , reply ) => {
4242 fastify . cache . get ( 'one' , ( err , obj ) => {
43- if ( err ) t . threw ( err )
43+ t . error ( err )
4444 t . same ( obj . item , { one : true } )
45+
4546 reply . send ( )
4647 } )
4748 } )
@@ -66,7 +67,7 @@ test('cache is usable', async (t) => {
6667} )
6768
6869test ( 'cache is usable with function as plugin default options input' , async ( t ) => {
69- t . plan ( 3 )
70+ t . plan ( 4 )
7071
7172 const fastify = Fastify ( )
7273 await fastify . register ( async ( instance , options ) => {
@@ -81,16 +82,17 @@ test('cache is usable with function as plugin default options input', async (t)
8182 } )
8283
8384 fastify . get ( '/one' , ( req , reply ) => {
84- fastify . cache . set ( 'one' , { one : true } , 100 , ( err ) => {
85+ fastify . cache . set ( 'one' , { one : true } , 1000 , ( err ) => {
8586 if ( err ) return reply . send ( err )
8687 reply . redirect ( '/two' )
8788 } )
8889 } )
8990
9091 fastify . get ( '/two' , ( req , reply ) => {
9192 fastify . cache . get ( 'one' , ( err , obj ) => {
92- if ( err ) t . threw ( err )
93+ t . error ( err )
9394 t . same ( obj . item , { one : true } )
95+
9496 reply . send ( )
9597 } )
9698 } )
0 commit comments