blob: f35b6699e3fe2b75df1d98f689dee07b7f0ccab1 [file]
import { DefaultRoleManager } from '../../src';
import { keyMatch2Func } from '../../src/util';
test('TestAllMatchingFunc', async () => {
const rm = new DefaultRoleManager(10);
await rm.addMatchingFunc(keyMatch2Func);
await rm.addDomainMatchingFunc(keyMatch2Func);
await rm.addLink('/book/:id', 'book_group', '*');
// Current role inheritance tree after deleting the links:
// *:book_group
// |
// *:/book/:id
expect(await rm.hasLink('/book/1', 'book_group', 'domain1')).toBe(true);
});