aboutsummaryrefslogtreecommitdiff
path: root/test/profile-conditions-util.test.js
diff options
context:
space:
mode:
authorJames Maa <jmaa@berkeley.edu>2024-05-31 08:06:52 -0700
committerGitHub <noreply@github.com>2024-05-31 15:06:52 +0000
commit76ca08bd59f0e8bfa1bb20ac813f48e7ab241265 (patch)
treebdba43d9ba704885383c7f308c6fe3f574c647c5 /test/profile-conditions-util.test.js
parentb3f54747eb2694bdc90bce72e5532e99d374ef08 (diff)
Allow trailing commas in ESLint (#1013)
* Update comma-dangle rule * Fix dangling commas
Diffstat (limited to 'test/profile-conditions-util.test.js')
-rw-r--r--test/profile-conditions-util.test.js662
1 files changed, 331 insertions, 331 deletions
diff --git a/test/profile-conditions-util.test.js b/test/profile-conditions-util.test.js
index 590e5873..e85a6997 100644
--- a/test/profile-conditions-util.test.js
+++ b/test/profile-conditions-util.test.js
@@ -26,26 +26,26 @@ describe('Profile conditions utilities', () => {
// Empty
{
context: {index: 0},
- expected: {index: 0, flags: []}
+ expected: {index: 0, flags: []},
},
// Domain normalization
{
context: {depth: 0, url: ''},
- expected: {depth: 0, url: '', flags: []}
+ expected: {depth: 0, url: '', flags: []},
},
{
context: {depth: 0, url: 'http://example.com/'},
- expected: {depth: 0, url: 'http://example.com/', domain: 'example.com', flags: []}
+ expected: {depth: 0, url: 'http://example.com/', domain: 'example.com', flags: []},
},
{
context: {depth: 0, url: 'http://example.com:1234/'},
- expected: {depth: 0, url: 'http://example.com:1234/', domain: 'example.com', flags: []}
+ expected: {depth: 0, url: 'http://example.com:1234/', domain: 'example.com', flags: []},
},
{
context: {depth: 0, url: 'http://user@example.com:1234/'},
- expected: {depth: 0, url: 'http://user@example.com:1234/', domain: 'example.com', flags: []}
- }
+ expected: {depth: 0, url: 'http://user@example.com:1234/', domain: 'example.com', flags: []},
+ },
];
test.each(data)('normalize-context-test-%#', ({context, expected}) => {
@@ -63,27 +63,27 @@ describe('Profile conditions utilities', () => {
conditionGroups: [],
expectedSchema: {},
inputs: [
- {expected: true, context: {depth: 0, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
- {conditions: []}
+ {conditions: []},
],
expectedSchema: {},
inputs: [
- {expected: true, context: {depth: 0, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
{conditions: []},
- {conditions: []}
+ {conditions: []},
],
expectedSchema: {},
inputs: [
- {expected: true, context: {depth: 0, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/'}},
+ ],
},
// popupLevel tests
@@ -94,22 +94,22 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'equal',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
- depth: {const: 0}
+ depth: {const: 0},
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 1, url: 'http://example.com/'}},
- {expected: false, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -118,28 +118,28 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'notEqual',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
anyOf: [
{
properties: {
- depth: {const: 0}
+ depth: {const: 0},
},
- required: ['depth']
- }
- ]
- }
+ required: ['depth'],
+ },
+ ],
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
- {expected: true, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -148,25 +148,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'lessThan',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 0
- }
+ exclusiveMaximum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 1, url: 'http://example.com/'}},
- {expected: true, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -175,25 +175,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
- {expected: false, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -202,25 +202,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'lessThanOrEqual',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- maximum: 0
- }
+ maximum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 1, url: 'http://example.com/'}},
- {expected: true, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -229,25 +229,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThanOrEqual',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- minimum: 0
- }
+ minimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
- {expected: false, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
// Url tests
@@ -258,28 +258,28 @@ describe('Profile conditions utilities', () => {
{
type: 'url',
operator: 'matchDomain',
- value: 'example.com'
- }
- ]
- }
+ value: 'example.com',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
domain: {
oneOf: [
- {const: 'example.com'}
- ]
- }
+ {const: 'example.com'},
+ ],
+ },
},
- required: ['domain']
+ required: ['domain'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 0, url: 'http://example1.com/'}},
{expected: false, context: {depth: 0, url: 'http://example2.com/'}},
{expected: true, context: {depth: 0, url: 'http://example.com:1234/'}},
- {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}},
+ ],
},
{
conditionGroups: [
@@ -288,10 +288,10 @@ describe('Profile conditions utilities', () => {
{
type: 'url',
operator: 'matchDomain',
- value: 'example.com, example1.com, example2.com'
- }
- ]
- }
+ value: 'example.com, example1.com, example2.com',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -299,11 +299,11 @@ describe('Profile conditions utilities', () => {
oneOf: [
{const: 'example.com'},
{const: 'example1.com'},
- {const: 'example2.com'}
- ]
- }
+ {const: 'example2.com'},
+ ],
+ },
},
- required: ['domain']
+ required: ['domain'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
@@ -311,8 +311,8 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example2.com/'}},
{expected: false, context: {depth: 0, url: 'http://example3.com/'}},
{expected: true, context: {depth: 0, url: 'http://example.com:1234/'}},
- {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}},
+ ],
},
{
conditionGroups: [
@@ -321,20 +321,20 @@ describe('Profile conditions utilities', () => {
{
type: 'url',
operator: 'matchRegExp',
- value: '^http://example\\d?\\.com/[\\w\\W]*$'
- }
- ]
- }
+ value: '^http://example\\d?\\.com/[\\w\\W]*$',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
url: {
type: 'string',
pattern: '^http://example\\d?\\.com/[\\w\\W]*$',
- patternFlags: 'i'
- }
+ patternFlags: 'i',
+ },
},
- required: ['url']
+ required: ['url'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
@@ -344,8 +344,8 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example.com/example'}},
{expected: false, context: {depth: 0, url: 'http://example.com:1234/'}},
{expected: false, context: {depth: 0, url: 'http://user@example.com:1234/'}},
- {expected: false, context: {depth: 0, url: 'http://example-1.com/'}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example-1.com/'}},
+ ],
},
// modifierKeys tests
@@ -356,27 +356,27 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'are',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
modifierKeys: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
+ minItems: 0,
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -385,10 +385,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'are',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -398,18 +398,18 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -418,10 +418,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'areNot',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -431,20 +431,20 @@ describe('Profile conditions utilities', () => {
modifierKeys: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
+ minItems: 0,
+ },
},
- required: ['modifierKeys']
- }
- ]
- }
+ required: ['modifierKeys'],
+ },
+ ],
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -453,10 +453,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'areNot',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -469,21 +469,21 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
},
- required: ['modifierKeys']
- }
- ]
- }
+ required: ['modifierKeys'],
+ },
+ ],
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -492,26 +492,26 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'include',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
modifierKeys: {
type: 'array',
- minItems: 0
- }
+ minItems: 0,
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -520,10 +520,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'include',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -532,18 +532,18 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -552,25 +552,25 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'notInclude',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
modifierKeys: {
- type: 'array'
- }
+ type: 'array',
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -579,10 +579,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'notInclude',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -591,19 +591,19 @@ describe('Profile conditions utilities', () => {
not: {
anyOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
// Flags tests
@@ -614,10 +614,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'are',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -625,9 +625,9 @@ describe('Profile conditions utilities', () => {
flags: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
- }
+ minItems: 0,
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -636,8 +636,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -646,10 +646,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'are',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -660,10 +660,10 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: ''}},
@@ -672,8 +672,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -682,10 +682,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'areNot',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -696,12 +696,12 @@ describe('Profile conditions utilities', () => {
flags: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
- }
- }
- ]
- }
+ minItems: 0,
+ },
+ },
+ },
+ ],
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: ''}},
@@ -710,8 +710,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -720,10 +720,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'areNot',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -737,13 +737,13 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
- }
- ]
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
+ },
+ ],
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -752,8 +752,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -762,19 +762,19 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'include',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
properties: {
flags: {
type: 'array',
- minItems: 0
- }
- }
+ minItems: 0,
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -783,8 +783,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -793,10 +793,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'include',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -806,10 +806,10 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: ''}},
@@ -818,8 +818,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -828,18 +828,18 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'notInclude',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
properties: {
flags: {
- type: 'array'
- }
- }
+ type: 'array',
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -848,8 +848,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -858,10 +858,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'notInclude',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -871,11 +871,11 @@ describe('Profile conditions utilities', () => {
not: {
anyOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -884,8 +884,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
// Multiple conditions tests
@@ -896,15 +896,15 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
- }
- ]
- }
+ value: '3',
+ },
+ ],
+ },
],
expectedSchema: {
allOf: [
@@ -912,21 +912,21 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 3
- }
+ exclusiveMaximum: 3,
+ },
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
inputs: [
{expected: false, context: {depth: -2, url: 'http://example.com/'}},
@@ -934,8 +934,8 @@ describe('Profile conditions utilities', () => {
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
{expected: true, context: {depth: 2, url: 'http://example.com/'}},
- {expected: false, context: {depth: 3, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: 3, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -944,24 +944,24 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
- }
- ]
+ value: '3',
+ },
+ ],
},
{
conditions: [
{
type: 'popupLevel',
operator: 'equal',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
anyOf: [
@@ -971,29 +971,29 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 3
- }
+ exclusiveMaximum: 3,
+ },
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
{
properties: {
- depth: {const: 0}
+ depth: {const: 0},
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
inputs: [
{expected: false, context: {depth: -2, url: 'http://example.com/'}},
@@ -1001,8 +1001,8 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
{expected: true, context: {depth: 2, url: 'http://example.com/'}},
- {expected: false, context: {depth: 3, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: 3, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -1011,29 +1011,29 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
- }
- ]
+ value: '3',
+ },
+ ],
},
{
conditions: [
{
type: 'popupLevel',
operator: 'lessThanOrEqual',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'greaterThanOrEqual',
- value: '-1'
- }
- ]
- }
+ value: '-1',
+ },
+ ],
+ },
],
expectedSchema: {
anyOf: [
@@ -1043,21 +1043,21 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 3
- }
+ exclusiveMaximum: 3,
+ },
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
{
allOf: [
@@ -1065,23 +1065,23 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- maximum: 0
- }
+ maximum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- minimum: -1
- }
+ minimum: -1,
+ },
},
- required: ['depth']
- }
- ]
- }
- ]
+ required: ['depth'],
+ },
+ ],
+ },
+ ],
},
inputs: [
{expected: false, context: {depth: -2, url: 'http://example.com/'}},
@@ -1089,9 +1089,9 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
{expected: true, context: {depth: 2, url: 'http://example.com/'}},
- {expected: false, context: {depth: 3, url: 'http://example.com/'}}
- ]
- }
+ {expected: false, context: {depth: 3, url: 'http://example.com/'}},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */