@isleward/test-helpers
v1.0.0
Published
Shared test helpers for Isleward server and mod test suites.
Readme
@isleward/test-helpers
Shared test helpers for Isleward server and mod test suites.
This package keeps common Node test helpers in one place so the main game repo and
standalone mod repositories can run the same tests without reaching into another
repository's test/helpers folder.
Installation
Use the GitLab repository as a development dependency:
npm install --save-dev git+ssh://[email protected]:Isleward/tools/test-helpers.gitUsage
Create an in-memory IO adapter:
const { createMemoryIo } = require('@isleward/test-helpers/memoryIo');
const memory = createMemoryIo({
accounts: {
'account-1': { username: 'Player' }
}
});
global.io = memory.io;Build router messages from server signatures:
const { makeThreadGlobalMessage } = require('@isleward/test-helpers/routerMessages');
const msg = makeThreadGlobalMessage({
signatures,
threadModule: 'mailManager',
method: 'getMail'
});Helpers
memoryIo: providescreateMemoryIo(initialData)for tests that need a small async IO implementation with snapshots and operation tracking.routerMessages: provides message builders for route validation tests:buildData,makeGlobalMessage,makeThreadCpnAction, andmakeThreadGlobalMessage.
Releasing
This package is consumed directly from GitLab. Changes on main are available to
repositories that install from:
git+ssh://[email protected]:Isleward/tools/test-helpers.git