Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583878
owner.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
owner.test.js
View Options
const
assert
=
require
(
"assert"
);
const
Context
=
require
.
main
.
require
(
"lib/context.js"
);
const
owner
=
require
.
main
.
require
(
"lib/base-chips/access-strategy-types/owner.js"
);
const
assert_no_error
=
require
.
main
.
require
(
"tests/util/assert-no-error.js"
);
const
assert_error
=
require
.
main
.
require
(
"tests/util/assert-error.js"
);
describe
(
"AccessStrategy.owner"
,
function
(){
it
(
"checks if the user is the owner and returns true"
,
function
(
done
){
const
context
=
new
Context
(
undefined
,
"ip"
,
"user_id"
);
const
item
=
{
created_context
:
{
user_id
:
"user_id"
}
}
const
result
=
owner
.
checker_function
(
context
,
{},
item
);
assert_no_error
(
result
,
done
);
});
it
(
"throws if the owner id doesn't match the owner in the created_context"
,
function
(
done
){
const
context
=
new
Context
(
undefined
,
"ip"
,
"user_id"
);
const
item
=
{
created_context
:
{
user_id
:
"other_user_id"
}
}
const
result
=
owner
.
checker_function
(
context
,
{},
item
);
assert_error
(
result
,
done
);
});
it
(
"checks item_sensitive attribute"
,
function
()
{
assert
.
strictEqual
(
owner
.
item_sensitive
,
true
);
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 11:02 (18 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984254
Default Alt Text
owner.test.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment