Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/static_src/reducers/issueV0.test.js b/static_src/reducers/issueV0.test.js
index b79cdb5..9e9a0b1 100644
--- a/static_src/reducers/issueV0.test.js
+++ b/static_src/reducers/issueV0.test.js
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -300,72 +300,103 @@
     });
   });
 
-  it('migratedId', () => {
-    assert.equal(issueV0.migratedId(wrapIssue()), '');
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: []})), '');
+  describe('migratedId', () => {
+    it('no id on empty labels', () => {
+      assert.equal(issueV0.migratedId(wrapIssue()), '');
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: []})), '');
+    });
 
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'IgnoreThis'},
-      {label: 'IgnoreThis2'},
-    ]})), '');
+    it('ignores irrelevant labels', () => {
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'IgnoreThis'},
+        {label: 'IgnoreThis2'},
+      ]})), '');
 
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'IgnoreThis'},
-      {label: 'IgnoreThis2'},
-      {label: 'migrated-to-b-6789'},
-    ]})), '6789');
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'IgnoreThis'},
+        {label: 'IgnoreThis2'},
+        {label: 'migrated-to-b-6789'},
+      ]})), '6789');
+    });
 
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'migrated-to-b-1234'},
-    ]})), '1234');
+    it('finds first relevant label', () => {
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'migrated-to-b-1234'},
+      ]})), '1234');
 
-    // We assume there's only one migrated-to-b-* label.
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'migrated-to-b-1234'},
-      {label: 'migrated-to-b-6789'},
-    ]})), '1234');
+      // We assume there's only one migrated-to-b-* label.
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'migrated-to-b-1234'},
+        {label: 'migrated-to-b-6789'},
+      ]})), '1234');
+    });
 
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'IgnoreThis'},
-      {label: 'IgnoreThis2'},
-      {label: 'migrated-to-launch-6789'},
-    ]})), '6789');
+    it('finds copybara labels', () => {
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'copybara-migration-complete-1234'},
+      ]})), '1234');
 
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'migrated-to-launch-1234'},
-    ]})), '1234');
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'copybara-migration-complete-1234'},
+        {label: 'migrated-to-b-6789'},
+      ]})), '1234');
+    });
 
-    // We assume there's only one migrated-to-* label.
-    assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
-      {label: 'migrated-to-launch-1234'},
-      {label: 'migrated-to-b-6789'},
-    ]})), '1234');
+    it('finds launch labels', () => {
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'IgnoreThis'},
+        {label: 'IgnoreThis2'},
+        {label: 'migrated-to-launch-6789'},
+      ]})), '6789');
+
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'migrated-to-launch-1234'},
+      ]})), '1234');
+
+      assert.equal(issueV0.migratedId(wrapIssue({labelRefs: [
+        {label: 'migrated-to-launch-1234'},
+        {label: 'migrated-to-b-6789'},
+      ]})), '1234');
+    });
   });
 
-  it('migratedType', () => {
-    assert.equal(issueV0.migratedType(wrapIssue()), migratedTypes.NONE);
-    assert.equal(issueV0.migratedType(wrapIssue({labelRefs: []})), migratedTypes.NONE);
+ describe('migratedType', () => {
+    it('none type on empty labels', () => {
+      assert.equal(issueV0.migratedType(wrapIssue()), migratedTypes.NONE);
+      assert.equal(issueV0.migratedType(wrapIssue({labelRefs: []})), migratedTypes.NONE);
+    });
 
-    assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
-      {label: 'IgnoreThis'},
-      {label: 'IgnoreThis2'},
-    ]})), migratedTypes.NONE);
+    it('none type on irrelevant labels', () => {
+      assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
+        {label: 'IgnoreThis'},
+        {label: 'IgnoreThis2'},
+      ]})), migratedTypes.NONE);
+    });
 
-    assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
-      {label: 'IgnoreThis'},
-      {label: 'IgnoreThis2'},
-      {label: 'migrated-to-b-6789'},
-    ]})), migratedTypes.BUGANIZER_TYPE);
+    it('buganizer type for buganizer labels', () => {
+      assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
+        {label: 'IgnoreThis'},
+        {label: 'IgnoreThis2'},
+        {label: 'migrated-to-b-6789'},
+      ]})), migratedTypes.BUGANIZER_TYPE);
 
-    assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
-      {label: 'migrated-to-launch-1234'},
-    ]})), migratedTypes.LAUNCH_TYPE);
+      assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
+        {label: 'IgnoreThis'},
+        {label: 'copybara-migration-complete-1234'},
+      ]})), migratedTypes.BUGANIZER_TYPE);
+    });
 
-    // We assume there's only one migrated-to-b-* label.
-    assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
-      {label: 'migrated-to-launch-1234'},
-      {label: 'migrated-to-b-6789'},
-    ]})), migratedTypes.LAUNCH_TYPE);
+    it('launch type for launch labels', () => {
+      assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
+        {label: 'migrated-to-launch-1234'},
+      ]})), migratedTypes.LAUNCH_TYPE);
+
+      // We assume there's only one migrated-to-b-* label.
+      assert.equal(issueV0.migratedType(wrapIssue({labelRefs: [
+        {label: 'migrated-to-launch-1234'},
+        {label: 'migrated-to-b-6789'},
+      ]})), migratedTypes.LAUNCH_TYPE);
+    });
   });