| Index: Tools/GardeningServer/model/test/ct-failure-group-tests.html
|
| diff --git a/Tools/GardeningServer/model/test/ct-failure-group-tests.html b/Tools/GardeningServer/model/test/ct-failure-group-tests.html
|
| index 52069a2ea7429f613be4f8dbe1c07aeba44317d6..94ec87617e4b38cef5469a5c53b8004b97674f4e 100644
|
| --- a/Tools/GardeningServer/model/test/ct-failure-group-tests.html
|
| +++ b/Tools/GardeningServer/model/test/ct-failure-group-tests.html
|
| @@ -26,19 +26,20 @@ describe('ct-failure-group', function() {
|
|
|
| describe('category', function() {
|
| it('should be "default" by default', function() {
|
| - var group = new CTFailureGroup('', [], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([]));
|
| assert.equal(group.category, 'default');
|
| });
|
|
|
| it('should be "snoozed" when snoozed', function() {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation({snoozeTime: Date.now() + 1000 * 1000})], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData(
|
| + [newFailureWithAnnotation({snoozeTime: Date.now() + 1000 * 1000})]));
|
| assert.equal(group.category, 'snoozed');
|
| });
|
| });
|
|
|
| describe('snooze', function() {
|
| it('should set isSnoozed', function(done) {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation()], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([newFailureWithAnnotation()]));
|
| group.snoozeUntil(Date.now() + 1000 * 1000).then(function() {
|
| assert.isTrue(group.isSnoozed);
|
| done();
|
| @@ -48,7 +49,7 @@ describe('ct-failure-group', function() {
|
|
|
| describe('unsnooze', function() {
|
| it('should clear isSnoozed', function(done) {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation()], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([newFailureWithAnnotation()]));
|
| group.snoozeUntil(Date.now() + 1000 * 1000).then(function() {
|
| group.unsnooze().then(function() {
|
| assert.isFalse(group.isSnoozed);
|
| @@ -60,7 +61,7 @@ describe('ct-failure-group', function() {
|
|
|
| describe('setBug', function() {
|
| it('should store the bug', function(done) {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation()], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([newFailureWithAnnotation()]));
|
| group.setBug('123').then(function() {
|
| assert.equal(group.bug, 'http://crbug.com/123');
|
| assert.equal(group._annotation.bug, 'http://crbug.com/123');
|
| @@ -70,7 +71,7 @@ describe('ct-failure-group', function() {
|
| });
|
|
|
| it('should support URLs', function(done) {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation()], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([newFailureWithAnnotation()]));
|
| group.setBug('http://foobar.com/?id=876&x=y').then(function() {
|
| assert.equal(group.bug, 'http://foobar.com/?id=876&x=y');
|
| assert.equal(group._annotation.bug, 'http://foobar.com/?id=876&x=y');
|
| @@ -82,7 +83,7 @@ describe('ct-failure-group', function() {
|
|
|
| describe('clearBug', function() {
|
| it('should work', function(done) {
|
| - var group = new CTFailureGroup('', [], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([]));
|
| group.setBug('123').then(function() {
|
| group.clearBug().then(function() {
|
| assert.isUndefined(group.bug);
|
| @@ -96,7 +97,7 @@ describe('ct-failure-group', function() {
|
|
|
| describe('annotations', function() {
|
| it('should have sensible defaults', function() {
|
| - var group = new CTFailureGroup('', [], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([]));
|
| assert.deepEqual(group._annotation, {});
|
| assert.isFalse(group.isSnoozed);
|
| assert.isUndefined(group.bug);
|
| @@ -104,41 +105,41 @@ describe('ct-failure-group', function() {
|
| });
|
|
|
| it('should compute properties', function() {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation(
|
| - {snoozeTime: Date.now() + 1000 * 1000, bug: 'http://crbug.com/123'})], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData([newFailureWithAnnotation(
|
| + {snoozeTime: Date.now() + 1000 * 1000, bug: 'http://crbug.com/123'})]));
|
| assert.isTrue(group.isSnoozed);
|
| assert.equal(group.bug, 'http://crbug.com/123');
|
| });
|
|
|
| it('should ignore snoozeTime unless it is present on all alerts', function() {
|
| - var notSnoozedMultipleAlerts = new CTFailureGroup('', [
|
| + var notSnoozedMultipleAlerts = new CTFailureGroup('', new CTSheriffFailureGroupData([
|
| new CTFailure('step', 'reason', [
|
| {key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
|
| {key: 'b',},
|
| - ], undefined)
|
| - ]);
|
| - var notSnoozedMultipleFailures = new CTFailureGroup('', [
|
| + ])
|
| + ]));
|
| + var notSnoozedMultipleFailures = new CTFailureGroup('', new CTSheriffFailureGroupData([
|
| new CTFailure('step', 'reason', [
|
| {key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
|
| ]),
|
| new CTFailure('step', 'reason', [
|
| {key: 'b'},
|
| ]),
|
| - ], undefined);
|
| - var snoozedMultipleAlerts = new CTFailureGroup('', [
|
| + ]));
|
| + var snoozedMultipleAlerts = new CTFailureGroup('', new CTSheriffFailureGroupData([
|
| new CTFailure('step', 'reason', [
|
| {key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
|
| {key: 'b', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
|
| ])
|
| - ], undefined);
|
| - var snoozedMultipleFailures = new CTFailureGroup('', [
|
| + ]));
|
| + var snoozedMultipleFailures = new CTFailureGroup('', new CTSheriffFailureGroupData([
|
| new CTFailure('step', 'reason', [
|
| {key: 'a', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
|
| ]),
|
| new CTFailure('step', 'reason', [
|
| {key: 'b', annotation: {snoozeTime: Date.now() + 1000 * 1000}},
|
| ]),
|
| - ], undefined);
|
| + ]));
|
| assert.isFalse(notSnoozedMultipleAlerts.isSnoozed);
|
| assert.isFalse(notSnoozedMultipleFailures.isSnoozed);
|
| assert.isTrue(snoozedMultipleAlerts.isSnoozed);
|
| @@ -149,23 +150,24 @@ describe('ct-failure-group', function() {
|
| var timeFuture = Date.now() + 1000 * 1000;
|
| var timePast = Date.now() - 1000 * 1000;
|
|
|
| - var notSnoozed = new CTFailureGroup('', [
|
| + var notSnoozed = new CTFailureGroup('', new CTSheriffFailureGroupData([
|
| new CTFailure('step', 'reason', [
|
| {key: 'a', annotation: {snoozeTime: timeFuture}},
|
| {key: 'b', annotation: {snoozeTime: timePast}},
|
| ])
|
| - ], undefined);
|
| + ]));
|
|
|
| assert.isFalse(notSnoozed.isSnoozed);
|
| });
|
|
|
| it('should be persisted', function(done) {
|
| - var group = new CTFailureGroup('', [newFailureWithAnnotation(), newFailureWithAnnotation()], undefined);
|
| + var group = new CTFailureGroup('', new CTSheriffFailureGroupData(
|
| + [newFailureWithAnnotation(), newFailureWithAnnotation()]));
|
| group.snoozeUntil(123).then(function() {
|
| group.setBug('456').then(function() {
|
| CTFailureGroup.fetchAnnotations().then(function(annotations) {
|
| - assert.deepEqual(annotations[group.failures[0].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
|
| - assert.deepEqual(annotations[group.failures[1].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
|
| + assert.deepEqual(annotations[group.data.failures[0].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
|
| + assert.deepEqual(annotations[group.data.failures[1].keys()[0]], {snoozeTime: 123, bug: 'http://crbug.com/456'});
|
| done();
|
| });
|
| });
|
|
|