mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
test: fix topics test and ServiceManager
This commit is contained in:
parent
598a08ec45
commit
94e15dbfa8
@ -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);
|
||||
|
@ -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];
|
||||
|
@ -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',
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user