@substrat-run/contract-tests 0.187.0 → 0.188.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-host-suite.d.ts","sourceRoot":"","sources":["../src/scope-host-suite.ts"],"names":[],"mappings":"AAEA,OAAO,EAuBL,KAAK,SAAS,EAyBf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAsBL,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAe9B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,oGAAoG;AACpG,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG;IAC5C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAChF,CAAC,GACD,IAAI,CA+GN;AAuCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,MACrB,OAAO,CAAC,OAAO,CAAC,QACb,SAAS,YACL,MAAM,KACf,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAC5C,IAAI,GAAE,qBAA0B,GAC/B,IAAI,
|
|
1
|
+
{"version":3,"file":"scope-host-suite.d.ts","sourceRoot":"","sources":["../src/scope-host-suite.ts"],"names":[],"mappings":"AAEA,OAAO,EAuBL,KAAK,SAAS,EAyBf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAsBL,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAe9B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,oGAAoG;AACpG,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG;IAC5C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAChF,CAAC,GACD,IAAI,CA+GN;AAuCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,MACrB,OAAO,CAAC,OAAO,CAAC,QACb,SAAS,YACL,MAAM,KACf,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAC5C,IAAI,GAAE,qBAA0B,GAC/B,IAAI,CAsgZN"}
|
package/dist/scope-host-suite.js
CHANGED
|
@@ -8952,6 +8952,63 @@ export function scopeHostContractSuite(adapterName, makeFixture, opts = {}) {
|
|
|
8952
8952
|
await host.admin.unsuspendScope(staff, t3, s3);
|
|
8953
8953
|
await expect(host.getScope(alice, t3, s3)).resolves.toBeDefined();
|
|
8954
8954
|
});
|
|
8955
|
+
describe('a scope whose stores a deletion is fencing cannot come back (D-71)', () => {
|
|
8956
|
+
const archivedScope = async (status = 'archived') => {
|
|
8957
|
+
const tenant = tenantId.parse(ulid());
|
|
8958
|
+
await host.admin.createTenant(staff, { id: tenant, slug: `fenced-${ulid().toLowerCase()}`, name: 'Fenced' });
|
|
8959
|
+
const scope = scopeId.parse(ulid());
|
|
8960
|
+
await host.provisionScope(staff, { tenantId: tenant, scopeId: scope, jurisdiction: 'eu' });
|
|
8961
|
+
await host.admin.activateScope(staff, tenant, scope);
|
|
8962
|
+
if (status === 'archived')
|
|
8963
|
+
await host.admin.archiveScope(staff, tenant, scope);
|
|
8964
|
+
return { tenant, scope };
|
|
8965
|
+
};
|
|
8966
|
+
it('an unarchive that got in first wins: nothing is marked, and the scope stays live', async () => {
|
|
8967
|
+
const { tenant, scope } = await archivedScope();
|
|
8968
|
+
await host.admin.unarchiveScope(staff, tenant, scope);
|
|
8969
|
+
await expectRefusal(host.admin.markScopeStoresFenced(staff, tenant, scope), 'conflict', /not archived/);
|
|
8970
|
+
expect(await host.admin.scopeStoresFencedAt(staff, tenant, scope)).toBeNull();
|
|
8971
|
+
expect((await host.admin.getScopeRecord(staff, tenant, scope))?.status).toBe('active');
|
|
8972
|
+
});
|
|
8973
|
+
it('once marked, an unarchive refuses naming a new scope, a retry answers as before, and it is audited once', async () => {
|
|
8974
|
+
const { tenant, scope } = await archivedScope();
|
|
8975
|
+
await host.admin.markScopeStoresFenced(staff, tenant, scope);
|
|
8976
|
+
await host.admin.markScopeStoresFenced(staff, tenant, scope);
|
|
8977
|
+
expect(await host.admin.scopeStoresFencedAt(staff, tenant, scope)).not.toBeNull();
|
|
8978
|
+
await expectRefusal(host.admin.unarchiveScope(staff, tenant, scope), 'conflict', /new scope/);
|
|
8979
|
+
expect((await host.admin.getScopeRecord(staff, tenant, scope))?.status).toBe('archived');
|
|
8980
|
+
expect(await host.admin.auditLog(staff, { scopeId: scope, action: 'markScopeStoresFenced' })).toHaveLength(1);
|
|
8981
|
+
});
|
|
8982
|
+
it('survives a directory dump and its restore', async () => {
|
|
8983
|
+
const { tenant, scope } = await archivedScope();
|
|
8984
|
+
await host.admin.markScopeStoresFenced(staff, tenant, scope);
|
|
8985
|
+
await host.admin.restoreDirectory(staff, await host.admin.exportDirectory(staff));
|
|
8986
|
+
await expectRefusal(host.admin.unarchiveScope(staff, tenant, scope), 'conflict', /new scope/);
|
|
8987
|
+
});
|
|
8988
|
+
it('a tenant with a marked scope cannot be un-deleted until that scope is reaped; a whole one can', async () => {
|
|
8989
|
+
const { tenant, scope } = await archivedScope();
|
|
8990
|
+
await host.admin.setTenantStatus(staff, tenant, 'deleting');
|
|
8991
|
+
await host.admin.setTenantStatus(staff, tenant, 'active');
|
|
8992
|
+
await host.admin.setTenantStatus(staff, tenant, 'deleting');
|
|
8993
|
+
await host.admin.markScopeStoresFenced(staff, tenant, scope, { whileTenantDeleting: true });
|
|
8994
|
+
await expectRefusal(host.admin.setTenantStatus(staff, tenant, 'active'), 'conflict', /new scope/);
|
|
8995
|
+
expect((await host.admin.getTenant(staff, tenant))?.status).toBe('deleting');
|
|
8996
|
+
// A reaped scope was never coming back, so it holds nothing up.
|
|
8997
|
+
await host.admin.reapScope(staff, tenant, scope, { force: true });
|
|
8998
|
+
await host.admin.setTenantStatus(staff, tenant, 'active');
|
|
8999
|
+
});
|
|
9000
|
+
it('a tenant un-deleted before the mark wins: its stores are not fenced', async () => {
|
|
9001
|
+
const { tenant, scope } = await archivedScope();
|
|
9002
|
+
await expectRefusal(host.admin.markScopeStoresFenced(staff, tenant, scope, { whileTenantDeleting: true }), 'conflict', /no longer deleting/);
|
|
9003
|
+
expect(await host.admin.scopeStoresFencedAt(staff, tenant, scope)).toBeNull();
|
|
9004
|
+
});
|
|
9005
|
+
it('names an unknown scope as such', async () => {
|
|
9006
|
+
const { tenant } = await archivedScope();
|
|
9007
|
+
const unknown = scopeId.parse(ulid());
|
|
9008
|
+
await expectRefusal(host.admin.markScopeStoresFenced(staff, tenant, unknown), 'not_found');
|
|
9009
|
+
expect(await host.admin.scopeStoresFencedAt(staff, tenant, unknown)).toBeNull();
|
|
9010
|
+
});
|
|
9011
|
+
});
|
|
8955
9012
|
it('archive then un-archive is an explicit audited restore (§4.2)', async () => {
|
|
8956
9013
|
await host.admin.archiveScope(staff, t3, s3);
|
|
8957
9014
|
await expectRefusal(host.getScope(alice, t3, s3), 'conflict', /scope not active/);
|