OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../ct-failure-group.html"> | 7 <link rel="import" href="../ct-failure-group.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 (function () { | 10 (function () { |
(...skipping 21 matching lines...) Expand all Loading... |
32 var group = new CTFailureGroup('key', []); | 32 var group = new CTFailureGroup('key', []); |
33 group.snoozeUntil(Date.now() + 1000 * 1000).then(function() { | 33 group.snoozeUntil(Date.now() + 1000 * 1000).then(function() { |
34 group.unsnooze().then(function() { | 34 group.unsnooze().then(function() { |
35 assert.isFalse(group.isSnoozed); | 35 assert.isFalse(group.isSnoozed); |
36 done(); | 36 done(); |
37 }); | 37 }); |
38 }); | 38 }); |
39 }); | 39 }); |
40 }); | 40 }); |
41 | 41 |
| 42 describe('setBug', function() { |
| 43 it('should store the bug and set hasBug', function(done) { |
| 44 var group = new CTFailureGroup('key', []); |
| 45 group.setBug(123).then(function() { |
| 46 assert.isTrue(group.hasBug); |
| 47 assert.equal(group.annotation.bugNumber, 123); |
| 48 done(); |
| 49 }); |
| 50 }); |
| 51 }); |
| 52 |
42 describe('annotations', function() { | 53 describe('annotations', function() { |
43 it('should have sensible defaults', function() { | 54 it('should have sensible defaults', function() { |
44 var group = new CTFailureGroup('key', []); | 55 var group = new CTFailureGroup('key', []); |
45 assert.deepEqual(group.annotation, {}); | 56 assert.deepEqual(group.annotation, {}); |
46 assert.isFalse(group.isSnoozed); | 57 assert.isFalse(group.isSnoozed); |
47 }); | 58 }); |
48 | 59 |
49 it('should compute properties', function() { | 60 it('should compute properties', function() { |
50 var group = new CTFailureGroup('key', [], {snoozeTime: Date.now() + 1000 *
1000}); | 61 var group = new CTFailureGroup('key', [], {snoozeTime: Date.now() + 1000 *
1000, bugNumber: 123}); |
51 assert.isTrue(group.isSnoozed); | 62 assert.isTrue(group.isSnoozed); |
| 63 assert.isTrue(group.hasBug); |
52 }); | 64 }); |
53 | 65 |
54 it('should be persisted', function(done) { | 66 it('should be persisted', function(done) { |
55 var group = new CTFailureGroup('key', []); | 67 var group = new CTFailureGroup('key', []); |
56 group.snoozeUntil(123).then(function() { | 68 group.snoozeUntil(123).then(function() { |
57 CTFailureGroup.fetchAnnotations().then(function(annotations) { | 69 group.setBug(456).then(function() { |
58 assert.deepEqual(annotations['key'], {snoozeTime: 123}); | 70 CTFailureGroup.fetchAnnotations().then(function(annotations) { |
59 done(); | 71 assert.deepEqual(annotations['key'], {snoozeTime: 123, bugNumber: 45
6}); |
| 72 done(); |
| 73 }); |
60 }); | 74 }); |
61 }); | 75 }); |
62 }); | 76 }); |
63 }); | 77 }); |
64 }); | 78 }); |
65 | 79 |
66 })() | 80 })() |
67 </script> | 81 </script> |
OLD | NEW |