go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/milo/ui/src/common/tools/cluster_utils/cluster_utils.test.ts (about) 1 // Copyright 2023 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 import { AssociatedBug } from '@/proto/go.chromium.org/luci/analysis/proto/v1/common.pb'; 16 17 import { getUniqueBugs } from './cluster_utils'; 18 19 describe('cluster_utils', () => { 20 const bug1: AssociatedBug = { 21 system: 'monorail', 22 id: '1234', 23 linkText: 'crbug.com/1234', 24 url: 'http://crbug.com/1234', 25 }; 26 27 const bug2: AssociatedBug = { 28 system: 'monorail', 29 id: '5678', 30 linkText: 'crbug.com/5678', 31 url: 'http://crbug.com/5678', 32 }; 33 34 const bug3: AssociatedBug = { 35 system: 'buganizer', 36 id: '1234', 37 linkText: 'b/1234', 38 url: 'http://b/1234', 39 }; 40 41 const bug4: AssociatedBug = { 42 system: 'buganizer', 43 id: '1234', 44 linkText: 'b/1234', 45 url: 'http://b/1234', 46 }; 47 48 it('getUniqueBugs should remove duplicate bugs', () => { 49 const uniqueBugs = getUniqueBugs([bug1, bug2, bug3, bug4]); 50 expect(uniqueBugs.length).toBe(3); 51 }); 52 });