You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but perhaps I missing something for feathers-sync@3?
Steps to reproduce
add "ioredis": "^5.3.1" to dev deps
add below /test/ioredis.test.js
constassert=require('assert');constfeathers=require('@feathersjs/feathers');const{ redis }=require('../../lib');constRedis=require('ioredis');constredisClient=newRedis({lazyConnect: true,maxRetriesPerRequest: null});describe('ioredis tests',()=>{letapp;before(done=>{app=feathers().configure(redis({serialize: JSON.stringify,deserialize: JSON.parse,
redisClient
})).use('/todo',{events: ['custom'],asynccreate(data){returndata;}});app.sync.ready.then(()=>{done();});});it('duplicates client',()=>{assert.ok(redisClient.duplicate());});it('syncs on created with hook context',done=>{constoriginal={test: 'data'};app.service('todo').once('created',(data,context)=>{assert.deepStrictEqual(original,data);assert.ok(context);assert.deepStrictEqual(context.result,data);assert.strictEqual(context.method,'create');assert.strictEqual(context.type,'around');assert.strictEqual(context.service,app.service('todo'));assert.strictEqual(context.app,app);done();});app.service('todo').create(original).then(data=>assert.deepStrictEqual(original,data)).catch(done);});it('sends sync-out for service events',done=>{constmessage={message: 'This is a test'};app.once('sync-out',data=>{try{assert.deepStrictEqual(data,{event: 'created',path: 'todo',data: message,context: {arguments: [message,{}],data: message,params: {},type: 'around',statusCode: undefined,method: 'create',event: 'created',path: 'todo',result: message}});done();}catch(error){done(error);}});app.service('todo').create(message);});});
Expected behavior
Test complete
Actual behavior
Test fail
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
+ '{"event":"created","path":"todo","data":{"message":"This is a test"},"context":{"arguments":[{"message":"This is a test"},{}],"event":"created","result":{"message":"This is a test"},"data":{"message":"This is a test"},"params":{},"path":"todo","method":"create","type":"around"}}'
- {
- context: {
- arguments: [
- {
- message: 'This is a test'
- },
- {}
- ],
- data: {
- message: 'This is a test'
- },
- event: 'created',
- method: 'create',
- params: {},
- path: 'todo',
- result: {
- message: 'This is a test'
- },
- statusCode: undefined,
- type: 'around'
- },
- data: {
- message: 'This is a test'
- },
- event: 'created',
- path: 'todo'
- }
at Feathers.<anonymous> (test/adapters/ioredis.test.js:36:16)
at Object.onceWrapper (node:events:628:26)
at Feathers.emit (node:events:525:35)
at service.emit (lib/core.js:2:3446)
at /Users/jamesholcomb/code/feathers-sync/node_modules/@feathersjs/feathers/lib/events.js:15:55
at Array.forEach (<anonymous>)
at /Users/jamesholcomb/code/feathers-sync/node_modules/@feathersjs/feathers/lib/events.js:15:21
Trying to utilize
ioredis
for theredisClient
option (I depend on sentinels which is unsupported bynode-redis
functions as expected with feathers@4 and feathers-sync@2:
but perhaps I missing something for feathers-sync@3?
Steps to reproduce
Expected behavior
Test complete
Actual behavior
Test fail
System configuration
NodeJS version:
18.12.1
The text was updated successfully, but these errors were encountered: