fix: remove rxjs (#376)
Some checks are pending
Continuous Delivery / Publishing Dev (push) Waiting to run
NPM / Publish / test-and-publish (push) Waiting to run

* firstcommit

* removerxjs

* document-task

* documentation+clean

* fixregres

* fix+regress

* fix+regres+errorhandling
This commit is contained in:
Jacob Nguyen
2025-01-13 10:33:53 -06:00
committed by GitHub
parent 7deb79e907
commit 59d08ef207
18 changed files with 970 additions and 906 deletions

View File

@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { Presence } from '../../src';
import * as Files from '../../src/core/module-loading'
import { presenceHandler } from '../../src/handlers/presence'
// Example test suite for the module function
describe('module function', () => {
@@ -54,4 +55,38 @@ describe('of function', () => {
activities: [{ name: 'Another Test Activity' }],
});
});
})
describe('Presence module execution', () => {
const mockExecuteResult = Presence.of({
status: 'online',
}).once();
const mockModule = Presence.module({
inject: [ '@sern/client'],
execute: vi.fn().mockReturnValue(mockExecuteResult)
})
beforeEach(() => {
vi.clearAllMocks();
// Mock Files.importModule
vi.spyOn(Files, 'importModule').mockResolvedValue({
module: mockModule
});
});
it('should set presence once.', async () => {
const setPresenceMock = vi.fn();
const mockPath = '/path/to/presence/config';
await presenceHandler(mockPath, setPresenceMock);
expect(Files.importModule).toHaveBeenCalledWith(mockPath);
expect(setPresenceMock).toHaveBeenCalledOnce();
})
})