|
@@ -176,6 +176,134 @@ describe('OptionsNormalizer', () => {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ describe('identifiersPrefixRule', () => {
|
|
|
|
+ describe('variant #1: string option value', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: 'foo',
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: 'foo',
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('variant #2: empty string option value', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: '',
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: false,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('variant #3: option value is `true`', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: true,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: true,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('variant #4: option value is `false`', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: false,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: false,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('variant #5: option value is object', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: <any>{},
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: false,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('variant #6: option value is function', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: <any>{},
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: false,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe('variant #7: option value is number', () => {
|
|
|
|
+ before(() => {
|
|
|
|
+ optionsPreset = getNormalizedOptions({
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: <any>123,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ expectedOptionsPreset = {
|
|
|
|
+ ...DEFAULT_PRESET,
|
|
|
|
+ identifiersPrefix: '123',
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it('should normalize options preset', () => {
|
|
|
|
+ assert.deepEqual(optionsPreset, expectedOptionsPreset);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
describe('selfDefendingRule', () => {
|
|
describe('selfDefendingRule', () => {
|
|
before(() => {
|
|
before(() => {
|
|
optionsPreset = getNormalizedOptions({
|
|
optionsPreset = getNormalizedOptions({
|