Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1389931
access-strategy.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
680 B
Referenced Files
None
Subscribers
None
access-strategy.test.js
View Options
const
AccessStrategy
=
require
(
"./access-strategy.js"
);
const
sinon
=
require
(
"sinon"
);
const
assert
=
require
(
"assert"
);
describe
(
"AccessStrategy"
,
()
=>
{
it
(
"should throw an error when defining an access strategy without a 'checkItem' method"
,
()
=>
{
assert
.
throws
(()
=>
new
class
Empty
extends
AccessStrategy
{}());
});
it
(
"should warn if filterModelQuery method is missing from the declaration"
,
()
=>
{
sinon
.
spy
(
console
,
"warn"
);
new
class
NotForDB
extends
AccessStrategy
{
checkItem
()
{
return
AccessStrategy
.
allow
();
}
}();
const
calls_amount
=
console
.
warn
.
getCalls
().
length
;
console
.
warn
.
restore
();
assert
.
equal
(
calls_amount
,
1
);
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 27, 18:55 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
619456
Default Alt Text
access-strategy.test.js (680 B)
Attached To
Mode
rSREWRITE Sealious-rewrite
Attached
Detach File
Event Timeline
Log In to Comment