From 94e15dbfa83ac11153fcc4d43635692833be3a97 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 18 Oct 2024 16:33:14 -0400 Subject: [PATCH] test: fix topics test and ServiceManager --- src/putility/src/features/TopicsFeature.js | 4 ++++ src/putility/src/system/ServiceManager.js | 2 +- src/putility/test/topics.test.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/putility/src/features/TopicsFeature.js b/src/putility/src/features/TopicsFeature.js index 365679d6..bd697de9 100644 --- a/src/putility/src/features/TopicsFeature.js +++ b/src/putility/src/features/TopicsFeature.js @@ -16,6 +16,10 @@ module.exports = { instance.mixin(TTopics, { pub: (k, v) => { + if ( k.includes('!') ) { + throw new Error( + '"!" in event name reserved for future use'); + } const topic = instance._.topics[k]; if ( ! topic ) { console.warn('missing topic: ' + topic); diff --git a/src/putility/src/system/ServiceManager.js b/src/putility/src/system/ServiceManager.js index a2e67987..ac786191 100644 --- a/src/putility/src/system/ServiceManager.js +++ b/src/putility/src/system/ServiceManager.js @@ -66,7 +66,7 @@ class ServiceManager extends AdvancedBase { async maybe_init_ (name) { const entry = this.services_m_[name]; - const depends = entry.instance.get_depends(); + const depends = entry.instance.as(TService).get_depends(); const waiting_for = []; for ( const depend of depends ) { const depend_entry = this.services_m_[depend]; diff --git a/src/putility/test/topics.test.js b/src/putility/test/topics.test.js index 18b8702e..a8a2c061 100644 --- a/src/putility/test/topics.test.js +++ b/src/putility/test/topics.test.js @@ -1,3 +1,4 @@ +const { expect } = require('chai'); const { AdvancedBase } = require("../src/AdvancedBase"); const { TTopics, TDetachable } = require("../src/traits/traits"); @@ -14,7 +15,7 @@ describe('topics', () => { static IMPLEMENTS = { [TPunchable]: { punch () { - this.as(TTopics).pub('punched!', { + this.as(TTopics).pub('punched', { information: 'about the punch', in_whatever: 'format you desire', });