-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathtestUtil.ts
More file actions
29 lines (28 loc) · 975 Bytes
/
testUtil.ts
File metadata and controls
29 lines (28 loc) · 975 Bytes
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
import { deepMerge } from '../../tools/lib/configMigration.mjs';
import { PuterServer } from './server';
import { IConfig } from './types';
export const setupTestServer = async (configOverrides?: IConfig) => {
// read default config json
const defaultConfig = await import('../../config.default.json', {
with: {
type: 'json',
},
});
// merge default config with overrides and test defaults
const config = deepMerge(
deepMerge(defaultConfig, {
extensions: [],
port: 0,
database: { engine: 'sqlite', inMemory: true },
dynamo: { inMemory: true, bootstrapTables: true },
redis: { useMock: true },
s3: { localConfig: { inMemory: true } },
no_default_user: true,
no_devwatch: true,
}),
configOverrides ?? {},
);
const server = new PuterServer(config);
await server.start(true);
return server;
};