test(db): name the restore's plugin schemas as plugin ids allow

This commit is contained in:
Maurice
2026-11-17 14:24:27 +01:00
parent 09295781f4
commit ddb42ecf0a
@@ -50,11 +50,11 @@ describe('plugin schema names', () => {
});
it("PGSCHEMA-005: a restore drops only the role's own plugin schemas, then creates the dump's", () => {
const sql = pluginSchemasSql(['trek_plugin_a', 'trek_plugin_b']);
const sql = pluginSchemasSql(['trek_plugin_alpha', 'trek_plugin_beta']);
expect(sql).toContain("starts_with(nspname, 'trek_plugin_')");
expect(sql).toContain('pg_get_userbyid(nspowner) = current_user');
expect(sql).toContain("EXECUTE format('DROP SCHEMA %I CASCADE', r.nspname);");
expect(sql.endsWith('CREATE SCHEMA "trek_plugin_a";\nCREATE SCHEMA "trek_plugin_b";\n')).toBe(true);
expect(sql.endsWith('CREATE SCHEMA "trek_plugin_alpha";\nCREATE SCHEMA "trek_plugin_beta";\n')).toBe(true);
expect(pluginSchemasSql([])).not.toContain('CREATE SCHEMA');
expect(() => pluginSchemasSql(['auth'])).toThrow(/is not a plugin schema name/);
});