Skip to content

Commit

Permalink
New format to auth
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jun 27, 2020
1 parent f1e7fe5 commit e042580
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/base/auth.js
@@ -0,0 +1,35 @@
const assert = require("assert");
const yonius = require("../..");

describe("#toTokensM()", function() {
it("should covert tokens to map representation", () => {
let result;

result = yonius.toTokensM(["admin"]);
assert.deepStrictEqual(result, { admin: true });

result = yonius.toTokensM(["admin", "admin.read"]);
assert.deepStrictEqual(result, {
admin: {
_: true,
read: true
}
});

result = yonius.toTokensM(["admin.read", "admin"]);
assert.deepStrictEqual(result, {
admin: {
_: true,
read: true
}
});

result = yonius.toTokensM(["admin", "admin.*"]);
assert.deepStrictEqual(result, {
admin: {
_: true,
"*": true
}
});
});
});

0 comments on commit e042580

Please sign in to comment.