OLD | NEW |
(Empty) | |
| 1 <!-- |
| 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 |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <link rel="import" href="../ct-failure-group.html"> |
| 8 |
| 9 <script> |
| 10 (function () { |
| 11 |
| 12 var assert = chai.assert; |
| 13 |
| 14 describe('ct-failure-group', function() { |
| 15 |
| 16 beforeEach(function() { |
| 17 localStorage.removeItem('CTFailureGroupAnnotations'); |
| 18 }); |
| 19 |
| 20 describe('snooze', function() { |
| 21 it('should set isSnoozed', function(done) { |
| 22 var group = new CTFailureGroup('key', []); |
| 23 group.snoozeUntil(Date.now() + 1000 * 1000).then(function() { |
| 24 assert.isTrue(group.isSnoozed); |
| 25 done(); |
| 26 }); |
| 27 }); |
| 28 }); |
| 29 |
| 30 describe('unsnooze', function() { |
| 31 it('should clear isSnoozed', function(done) { |
| 32 var group = new CTFailureGroup('key', []); |
| 33 group.snoozeUntil(Date.now() + 1000 * 1000).then(function() { |
| 34 group.unsnooze().then(function() { |
| 35 assert.isFalse(group.isSnoozed); |
| 36 done(); |
| 37 }); |
| 38 }); |
| 39 }); |
| 40 }); |
| 41 |
| 42 describe('annotations', function() { |
| 43 it('should have sensible defaults', function() { |
| 44 var group = new CTFailureGroup('key', []); |
| 45 assert.deepEqual(group.annotation, {}); |
| 46 assert.isFalse(group.isSnoozed); |
| 47 }); |
| 48 |
| 49 it('should compute properties', function() { |
| 50 var group = new CTFailureGroup('key', [], {snoozeTime: Date.now() + 1000 *
1000}); |
| 51 assert.isTrue(group.isSnoozed); |
| 52 }); |
| 53 |
| 54 it('should be persisted', function(done) { |
| 55 var group = new CTFailureGroup('key', []); |
| 56 group.snoozeUntil(123).then(function() { |
| 57 CTFailureGroup.fetchAnnotations().then(function(annotations) { |
| 58 assert.deepEqual(annotations['key'], {snoozeTime: 123}); |
| 59 done(); |
| 60 }); |
| 61 }); |
| 62 }); |
| 63 }); |
| 64 }); |
| 65 |
| 66 })() |
| 67 </script> |
OLD | NEW |