feat: merge service (#14384)

This commit is contained in:
DarkSky
2026-02-07 04:52:25 +08:00
committed by GitHub
parent a0cf5681c4
commit 1a2410f541
49 changed files with 966 additions and 924 deletions
@@ -44,3 +44,12 @@ e2e('should init renderer service', async t => {
const res = await app.GET('/info').expect(200);
t.is(res.body.flavor, 'renderer');
});
e2e('should init front service', async t => {
// @ts-expect-error override
globalThis.env.FLAVOR = 'front';
await using app = await createApp();
const res = await app.GET('/info').expect(200);
t.is(res.body.flavor, 'front');
});
@@ -68,12 +68,14 @@ test('should read DEPLOYMENT_TYPE', t => {
test('should read FLAVOR', t => {
t.deepEqual(
['allinone', 'graphql', 'sync', 'renderer', 'doc', 'script'].map(envVal => {
process.env.SERVER_FLAVOR = envVal;
const env = new Env();
return env.FLAVOR;
}),
['allinone', 'graphql', 'sync', 'renderer', 'doc', 'script']
['allinone', 'graphql', 'sync', 'renderer', 'front', 'doc', 'script'].map(
envVal => {
process.env.SERVER_FLAVOR = envVal;
const env = new Env();
return env.FLAVOR;
}
),
['allinone', 'graphql', 'sync', 'renderer', 'front', 'doc', 'script']
);
t.throws(
@@ -83,7 +85,7 @@ test('should read FLAVOR', t => {
},
{
message:
'Invalid value "unknown" for environment variable SERVER_FLAVOR, expected one of ["allinone","graphql","sync","renderer","doc","script"]',
'Invalid value "unknown" for environment variable SERVER_FLAVOR, expected one of ["allinone","graphql","sync","renderer","front","doc","script"]',
}
);
});
@@ -110,6 +112,7 @@ test('should tell flavors correctly', t => {
graphql: true,
sync: true,
renderer: true,
front: false,
doc: true,
script: false,
});
@@ -119,6 +122,17 @@ test('should tell flavors correctly', t => {
graphql: true,
sync: false,
renderer: false,
front: false,
doc: false,
script: false,
});
process.env.SERVER_FLAVOR = 'front';
t.deepEqual(new Env().flavors, {
graphql: false,
sync: false,
renderer: false,
front: true,
doc: false,
script: false,
});
@@ -128,6 +142,7 @@ test('should tell flavors correctly', t => {
graphql: false,
sync: false,
renderer: false,
front: false,
doc: false,
script: true,
});