Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import type {JsonCrdtTestSetup} from '../../__tests__/setup';
import type {ApiTestSetup} from '../types';
export const runUtilTests = (_setup: ApiTestSetup) => {
const setup = _setup as JsonCrdtTestSetup;
describe('util.*', () => {
describe('util.ping', () => {
test('returns pong', async () => {
const {call, stop} = await setup();
const res = await call('util.ping', undefined);
expect(res).toBe('pong');
await stop();
});
});
describe('util.echo', () => {
test('returns strings', async () => {
const {call, stop} = await setup();
const res = await call('util.echo', 'hello world');
expect(res).toBe('hello world');
await stop();
});
test('returns objects', async () => {
const {call, stop} = await setup();
const res = await call('util.echo', {foo: 'bar'});
expect(res).toStrictEqual({foo: 'bar'});
await stop();
});
});
describe('util.info', () => {
test('returns stats object', async () => {
const {call, stop} = await setup();
const res = await call('util.info', {});
expect(res).toMatchObject({
now: expect.any(Number),
stats: {
pubsub: {
channels: expect.any(Number),
observers: expect.any(Number),
},
presence: {
rooms: expect.any(Number),
entries: expect.any(Number),
observers: expect.any(Number),
},
blocks: {
blocks: expect.any(Number),
batches: expect.any(Number),
},
},
});
await stop();
});
});
});
};
|