2022-08-23 07:04:43 +03:00
|
|
|
const assert = require('assert');
|
2022-02-09 12:34:09 +03:00
|
|
|
const MemberRepository = require('../../../../lib/repositories/member');
|
|
|
|
|
|
|
|
describe('MemberRepository', function () {
|
2022-03-18 13:47:24 +03:00
|
|
|
describe('#isComplimentarySubscription', function () {
|
2022-02-09 12:34:09 +03:00
|
|
|
it('Does not error when subscription.plan is null', function () {
|
|
|
|
const repo = new MemberRepository({});
|
|
|
|
repo.isComplimentarySubscription({});
|
|
|
|
});
|
|
|
|
});
|
2022-08-23 07:04:43 +03:00
|
|
|
|
|
|
|
describe('#resolveContextSource', function (){
|
|
|
|
it('Maps context to source', function (){
|
|
|
|
const repo = new MemberRepository({});
|
|
|
|
|
|
|
|
let source = repo._resolveContextSource({
|
|
|
|
import: true
|
|
|
|
});
|
|
|
|
assert.equal(source, 'import');
|
|
|
|
|
|
|
|
source = repo._resolveContextSource({
|
|
|
|
importer: true
|
|
|
|
});
|
|
|
|
assert.equal(source, 'import');
|
|
|
|
|
|
|
|
source = repo._resolveContextSource({
|
|
|
|
user: true
|
|
|
|
});
|
|
|
|
assert.equal(source, 'admin');
|
|
|
|
|
|
|
|
source = repo._resolveContextSource({
|
|
|
|
user: true,
|
|
|
|
api_key: true
|
|
|
|
});
|
|
|
|
assert.equal(source, 'admin');
|
|
|
|
|
|
|
|
source = repo._resolveContextSource({
|
|
|
|
api_key: true
|
|
|
|
});
|
|
|
|
assert.equal(source, 'api');
|
|
|
|
|
|
|
|
source = repo._resolveContextSource({
|
|
|
|
});
|
|
|
|
assert.equal(source, 'member');
|
|
|
|
|
|
|
|
source = repo._resolveContextSource({
|
|
|
|
generic_context: true
|
|
|
|
});
|
|
|
|
assert.equal(source, 'member');
|
|
|
|
});
|
|
|
|
});
|
2022-02-09 12:34:09 +03:00
|
|
|
});
|