Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-15 15:10:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-15 15:10:16 +0300
commitc70fec25f88e1f1866c6b3d91de8587bdad59391 (patch)
tree0e869771cd4702cfe9711fca921e7b3a124c91dc /spec/frontend/lib
parent340f85512a4b4fa1ffd558ecaf64fef2eec8cc87 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r--spec/frontend/lib/utils/array_utility_spec.js36
-rw-r--r--spec/frontend/lib/utils/secret_detection_spec.js1
2 files changed, 37 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/array_utility_spec.js b/spec/frontend/lib/utils/array_utility_spec.js
index 64ddd400114..94461c72106 100644
--- a/spec/frontend/lib/utils/array_utility_spec.js
+++ b/spec/frontend/lib/utils/array_utility_spec.js
@@ -42,4 +42,40 @@ describe('array_utility', () => {
expect(arrayUtils.getDuplicateItemsFromArray(array)).toEqual(result);
});
});
+
+ describe('toggleArrayItem', () => {
+ it('adds an item to the array if it does not exist', () => {
+ expect(arrayUtils.toggleArrayItem([], 'item')).toStrictEqual(['item']);
+ });
+
+ it('removes an item from the array if it already exists', () => {
+ expect(arrayUtils.toggleArrayItem(['item'], 'item')).toStrictEqual([]);
+ });
+
+ describe('pass by value', () => {
+ it('does not toggle the array item when passed a new object', () => {
+ expect(arrayUtils.toggleArrayItem([{ a: 1 }], { a: 1 })).toStrictEqual([
+ { a: 1 },
+ { a: 1 },
+ ]);
+ });
+
+ it('does not toggle the array item when passed a new array', () => {
+ expect(arrayUtils.toggleArrayItem([[1]], [1])).toStrictEqual([[1], [1]]);
+ });
+ });
+
+ describe('pass by reference', () => {
+ const array = [1];
+ const object = { a: 1 };
+
+ it('toggles the array item when passed a object reference', () => {
+ expect(arrayUtils.toggleArrayItem([object], object)).toStrictEqual([]);
+ });
+
+ it('toggles the array item when passed an array reference', () => {
+ expect(arrayUtils.toggleArrayItem([array], array)).toStrictEqual([]);
+ });
+ });
+ });
});
diff --git a/spec/frontend/lib/utils/secret_detection_spec.js b/spec/frontend/lib/utils/secret_detection_spec.js
index 3213ecf3fe1..761062f0340 100644
--- a/spec/frontend/lib/utils/secret_detection_spec.js
+++ b/spec/frontend/lib/utils/secret_detection_spec.js
@@ -28,6 +28,7 @@ describe('containsSensitiveToken', () => {
'token: feed_token=ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'token: feed_token=glft-ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'token: feed_token=glft-a8cc74ccb0de004d09a968705ba49099229b288b3de43f26c473a9d8d7fb7693-1234',
+ 'token: gloas-a8cc74ccb0de004d09a968705ba49099229b288b3de43f26c473a9d8d7fb7693',
'https://example.com/feed?feed_token=123456789_abcdefghij',
'glpat-1234567890 and feed_token=ABCDEFGHIJKLMNOPQRSTUVWXYZ',
];