mirror of
https://github.com/enso-org/enso.git
synced 2025-01-07 07:37:14 +03:00
9b7e3d0f16
- Closes #8179 # Important Notes - ⚠️ These tests are currently *not run* on any CI workflow. - There is some unused code for mocking the PM. This has been intentionally kept, as this may be useful in the future. Note that this may be useful for testing the dashboard, however the dashboard is currently only tested in cloud mode - that is, without the backend switcher, and with only the remote backend available. As such, currently it uses HTTP API mocks, and no PM mock.
39 lines
981 B
TypeScript
39 lines
981 B
TypeScript
import { Server } from '@open-rpc/server-js'
|
|
import * as random from 'lib0/random.js'
|
|
import {
|
|
methods as pmMethods,
|
|
projects,
|
|
type ProjectId,
|
|
type ProjectName,
|
|
type UTCDateTime,
|
|
} from './mockProjectManager'
|
|
import pmSpec from './pm-openrpc.json' assert { type: 'json' }
|
|
|
|
export default function setup() {
|
|
const pm = new Server({
|
|
transportConfigs: [
|
|
{
|
|
type: 'WebSocketTransport',
|
|
options: {
|
|
id: 'websocket',
|
|
udp: true,
|
|
ipv6: true,
|
|
port: 30535,
|
|
middleware: [],
|
|
},
|
|
},
|
|
],
|
|
openrpcDocument: pmSpec as typeof pmSpec & { openrpc: never },
|
|
methodMapping: pmMethods,
|
|
})
|
|
pm.start()
|
|
projects.set('mock project id 0001', {
|
|
id: random.uuidv4() as ProjectId,
|
|
created: new Date().toISOString() as UTCDateTime,
|
|
lastOpened: new Date().toISOString() as UTCDateTime,
|
|
engineVersion: '',
|
|
name: 'Mock Project Name' as ProjectName,
|
|
namespace: 'local',
|
|
})
|
|
}
|