Add flock exports, sharing invitations, and improved flock switching
This commit is contained in:
1 parent
ff177dbaed
commit
55353e4d46
12 files changed
+557
-100
No files matched your search
@@ -115,3 +115,20 @@ test('Swagger UI, initialization, assets and specification are served locally wi
|
||||
assert.equal(redirect.status, 301);
|
||||
assert.equal(redirect.headers.get('location'), '/api/docs/');
|
||||
});
|
||||
|
||||
test('bird removal is restricted to owners and assistants in the API and its documentation', () => {
|
||||
const route = ast.statements.find((statement) =>
|
||||
ts.isExpressionStatement(statement) && ts.isCallExpression(statement.expression) &&
|
||||
statement.expression.expression.getText(ast) === 'app.delete' &&
|
||||
statement.expression.arguments[0]?.getText(ast) === "'/api/birds/:birdId'"
|
||||
);
|
||||
assert.ok(route && ts.isExpressionStatement(route) && ts.isCallExpression(route.expression));
|
||||
const guard = route.expression.arguments.find((arg) =>
|
||||
ts.isCallExpression(arg) && arg.expression.getText(ast) === 'requireWorkspaceRole'
|
||||
);
|
||||
assert.ok(guard && ts.isCallExpression(guard));
|
||||
assert.equal(guard.arguments[0].getText(ast), "['owner', 'assistant']");
|
||||
const description = customerOpenApi.paths['/birds/{birdId}']!.delete!.description!;
|
||||
assert.match(description, /Allowed roles: owner, assistant\./);
|
||||
assert.doesNotMatch(description, /caregiver/);
|
||||
});
|
||||
Reference in new issue
Block a user