سامانه صدور فاکتور و حسابداری
test: allow multiple memberships while asserting cross-tenant isolation
davoodmehraban89 committed
Nov 17, 2026 at 10:21 UTC
02495ec080bf2597d11f6b28d3fe1259dc0214cb
1 file changed
+4
-4
scripts/wp2-auth-tenant-e2e.mjs
+4
-4
@@ -87,10 +87,10 @@ try {
87
const membersB = await rest('organization_members?select=organization_id,user_id', tokens[1]);
88
assert.equal(membersA.status, 200); assert.equal(membersB.status, 200);
89
const mA = await membersA.json(), mB = await membersB.json();
90
- assert.ok(mA.some(x => x.organization_id === orgA && x.user_id === users[0]));
91
- assert.ok(mA.every(x => x.organization_id === orgA), 'tenant A can read foreign membership');
92
- assert.ok(mB.some(x => x.organization_id === orgB && x.user_id === users[1]));
93
- assert.ok(mB.every(x => x.organization_id === orgB), 'tenant B can read foreign membership');
90
+ assert.ok(mA.some(x => x.organization_id === orgA && x.user_id === users[0]), 'tenant A cannot read its own membership');
91
+ assert.ok(!mA.some(x => x.organization_id === orgB), 'tenant A can read tenant B membership');
92
+ assert.ok(mB.some(x => x.organization_id === orgB && x.user_id === users[1]), 'tenant B cannot read its own membership');
93
+ assert.ok(!mB.some(x => x.organization_id === orgA), 'tenant B can read tenant A membership');
94
console.log('WP2_AUTH_TENANT_E2E_PASS: two Auth-issued JWTs; organization and membership RLS isolation verified through PostgREST.');
95
} finally {
96
// Supabase Local is disposable; preserve immutable audit evidence.