From c5456b3fcb580cb8c2ceca3568b7d29f184b0e62 Mon Sep 17 00:00:00 2001 From: qcqcqc <1220204124@zust.edu.cn> Date: Tue, 13 Jan 2026 15:04:08 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=EF=BC=9A=E5=B5=8C=E5=A5=97=E8=B7=A8=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/testcase/base.ts | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/test/testcase/base.ts b/test/testcase/base.ts index 098f282..7195021 100644 --- a/test/testcase/base.ts +++ b/test/testcase/base.ts @@ -1835,4 +1835,90 @@ export default (storeGetter: () => DbStore) => { assert(r1.length === 1, `Deeply nested query failed`); assert(r1[0].system?.platform?.name === 'test_platform', `Nested projection failed`); }); + + it('[1.4.1]嵌套跨节点表达式', async () => { + const store = storeGetter(); + const context = new TestContext(store); + await context.begin(); + + const platformId = v4(); + await store.operate('platform', { + id: v4(), + action: 'create', + data: { + id: platformId, + name: 'test2' + } + }, context, {}) + await store.operate('application', { + id: v4(), + action: 'create', + data: [{ + id: v4(), + name: 'test', + description: 'ttttt', + type: 'web', + system: { + id: v4(), + action: 'create', + data: { + id: v4(), + name: 'systest', + folder: 'systest', + platformId, + } + }, + }, { + id: v4(), + name: 'test222', + description: 'ttttt2', + type: 'web', + system: { + id: v4(), + action: 'create', + data: { + id: v4(), + name: 'test2222', + folder: 'test2', + platformId, + } + }, + }] + }, context, {}); + + process.env.NODE_ENV = 'development'; + + // 查询所有的application,过滤条件是application->system.name = application->system->platform.name + const apps = await store.select('application', { + data: { + id: 1, + name: 1, + system: { + id: 1, + name: 1, + platform: { + id: 1, + name: 1, + } + } + }, + filter: { + system: { + "#id": 'node-1', + platform: { + $expr: { + $eq: [ + { "#attr": 'name' }, + { "#refId": 'node-1', "#refAttr": 'folder' } + ] + } + } + } + } + }, context, {}); + + process.env.NODE_ENV = undefined; + assert(apps.length === 1 && apps[0].name === 'test222'); + await context.commit(); + }); } \ No newline at end of file