mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 02:15:11 +00:00
fix: test error
This commit is contained in:
parent
288823dab1
commit
b927115230
@ -239,13 +239,15 @@ export function mockServer(options: ApplicationOptions = {}) {
|
||||
...options,
|
||||
});
|
||||
|
||||
const basename = app.options.pubSubManager?.channelPrefix || app.name;
|
||||
const basename = app.options.pubSubManager?.channelPrefix;
|
||||
|
||||
app.pubSubManager.setAdapter(
|
||||
MemoryPubSubAdapter.create(basename, {
|
||||
debounce: 500,
|
||||
}),
|
||||
);
|
||||
if (basename) {
|
||||
app.pubSubManager.setAdapter(
|
||||
MemoryPubSubAdapter.create(basename, {
|
||||
debounce: 500,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return app;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ describe('file-manager > cluster', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
cluster = await createMockCluster({
|
||||
plugins: [[Plugin, { name: 'file-manager' }]],
|
||||
plugins: ['file-manager'],
|
||||
});
|
||||
});
|
||||
|
||||
@ -44,9 +44,7 @@ describe('file-manager > cluster', () => {
|
||||
path: 'a',
|
||||
});
|
||||
expect(p1.storagesCache.get(s1.id).path).toEqual('a');
|
||||
|
||||
await sleep(550);
|
||||
|
||||
expect(p2.storagesCache.get(s1.id).path).toEqual('a');
|
||||
});
|
||||
});
|
||||
|
@ -190,19 +190,25 @@ export default class PluginFileManagerServer extends Plugin {
|
||||
});
|
||||
|
||||
const Storage = this.db.getModel('storages');
|
||||
Storage.afterSave((m) => {
|
||||
Storage.afterSave((m, { transaction }) => {
|
||||
this.storagesCache.set(m.id, m.toJSON());
|
||||
this.sendSyncMessage({
|
||||
type: 'storageChange',
|
||||
storageId: m.id,
|
||||
});
|
||||
this.sendSyncMessage(
|
||||
{
|
||||
type: 'storageChange',
|
||||
storageId: m.id,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
});
|
||||
Storage.afterDestroy((m) => {
|
||||
Storage.afterDestroy((m, { transaction }) => {
|
||||
this.storagesCache.delete(m.id);
|
||||
this.sendSyncMessage({
|
||||
type: 'storageRemove',
|
||||
storageId: m.id,
|
||||
});
|
||||
this.sendSyncMessage(
|
||||
{
|
||||
type: 'storageRemove',
|
||||
storageId: m.id,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
});
|
||||
|
||||
this.app.acl.registerSnippet({
|
||||
|
Loading…
Reference in New Issue
Block a user