<commit_before>const { expect } = require('chai');
const {
	ScopeService, ScopePermissionService, ScopeListService,
} = require('../../../../src/services/helpers/scopePermissions');

describe('ScopeService', () => {
	it('should work', () => expect(ScopeService).to.be.ok);

	describe('#initialize', () => {
		it('should throw an error if no permission handler is provided', () => {
			expect(() => ScopeService.initialize({}, 'path')).to.throw(Error);
		});

		it('should register a new ScopeService instance at the provided path', () => {
			const SERVICE_PATH = 'lollipop';
			const fakeApp = {
				use: (path, service) => {
					expect(path).to.equal(SERVICE_PATH);
					expect(service).to.be.instanceOf(ScopeService);
				},
				service: () => ({
					hooks: () => true,
				}),
			};
			expect(() => ScopeService.initialize(fakeApp, SERVICE_PATH, () => true)).not.to.throw(Error);
		});

		it('should return an instance of the provided subclass', () => {
			const SERVICE_PATH = 'lollipop';
			let registeredService;
			const fakeApp = {
				use: (_path, service) => {
					registeredService = service;
					return true;
				},
				service: () => ({
					hooks: () => true,
				}),
			};

			[ScopeService, ScopePermissionService, ScopeListService].forEach((klass) => {
				klass.initialize(fakeApp, SERVICE_PATH, () => true);
				expect(registeredService).to.be.instanceOf(klass);
			});
		});
	});
});<commit_msg>Add ScopeMembersService to test case<commit_after>const { expect } = require('chai');
const {
	ScopeService, ScopePermissionService, ScopeListService, ScopeMembersService,
} = require('../../../../src/services/helpers/scopePermissions');

describe('ScopeService', () => {
	it('should work', () => expect(ScopeService).to.be.ok);

	describe('#initialize', () => {
		it('should throw an error if no permission handler is provided', () => {
			expect(() => ScopeService.initialize({}, 'path')).to.throw(Error);
		});

		it('should register a new ScopeService instance at the provided path', () => {
			const SERVICE_PATH = 'lollipop';
			const fakeApp = {
				use: (path, service) => {
					expect(path).to.equal(SERVICE_PATH);
					expect(service).to.be.instanceOf(ScopeService);
				},
				service: () => ({
					hooks: () => true,
				}),
			};
			expect(() => ScopeService.initialize(fakeApp, SERVICE_PATH, () => true)).not.to.throw(Error);
		});

		it('should return an instance of the provided subclass', () => {
			const SERVICE_PATH = 'lollipop';
			let registeredService;
			const fakeApp = {
				use: (_path, service) => {
					registeredService = service;
					return true;
				},
				service: () => ({
					hooks: () => true,
				}),
			};

			[ScopeService, ScopePermissionService, ScopeListService, ScopeMembersService].forEach((klass) => {
				klass.initialize(fakeApp, SERVICE_PATH, () => true);
				expect(registeredService).to.be.instanceOf(klass);
			});
		});
	});
});
{'fraction_non_alphanumeric': 0.1865748709122203, 'fraction_numerical': 0.0, 'mean_word_length': 3.679549114331723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5520282', 'n_tokens_mistral': 1060, 'n_tokens_neox': 895, 'n_words': 176}