| 1 |
// Copyright 2017 The Closure Library Authors. All Rights Reserved. |
| 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 |
goog.provide('goog.testing.TestRunnerTest'); |
| 16 |
goog.setTestOnly(); |
| 17 |
|
| 18 |
goog.require('goog.testing.TestCase'); |
| 19 |
goog.require('goog.testing.TestRunner'); |
| 20 |
goog.require('goog.testing.asserts'); |
| 21 |
goog.require('goog.testing.jsunit'); |
| 22 |
|
| 23 |
|
| 24 |
let testRunner; |
| 25 |
let testCase; |
| 26 |
|
| 27 |
function setUp() { |
| 28 |
testRunner = new goog.testing.TestRunner(); |
| 29 |
testCase = new goog.testing.TestCase(); |
| 30 |
} |
| 31 |
|
| 32 |
function testInitialize() { |
| 33 |
assert(!testRunner.isInitialized()); |
| 34 |
testRunner.initialize(testCase); |
| 35 |
assert(testRunner.isInitialized()); |
| 36 |
} |
| 37 |
|
| 38 |
function testIsFinished() { |
| 39 |
testRunner.initialize(testCase); |
| 40 |
assert(!testRunner.isFinished()); |
| 41 |
testRunner.logError('oops'); |
| 42 |
assert(testRunner.isFinished()); |
| 43 |
} |
| 44 |
|
| 45 |
function testGetUniqueId() { |
| 46 |
// We only really care that this string is unique to instances. |
| 47 |
const anotherRunner = new goog.testing.TestRunner(); |
| 48 |
assert(anotherRunner.getUniqueId() != testRunner.getUniqueId()); |
| 49 |
} |