aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/labs/mock/mock_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/labs/mock/mock_test.html')
-rw-r--r--contexts/data/lib/closure-library/closure/goog/labs/mock/mock_test.html115
1 files changed, 0 insertions, 115 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/labs/mock/mock_test.html b/contexts/data/lib/closure-library/closure/goog/labs/mock/mock_test.html
deleted file mode 100644
index 93a3984..0000000
--- a/contexts/data/lib/closure-library/closure/goog/labs/mock/mock_test.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2012 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<head>
-<title>Closure Unit Tests - goog.labs.mock</title>
-<script src="../../base.js"></script>
-<script>
-
-goog.require('goog.labs.mock');
-goog.require('goog.testing.jsunit');
-
-</script>
-</head>
-<body>
-<script>
-
-var ParentClass = function() {};
-ParentClass.prototype.method1 = function() {};
-ParentClass.prototype.x = 1;
-
-var ChildClass = function() {};
-goog.inherits(ChildClass, ParentClass);
-ChildClass.prototype.method2 = function() {};
-ChildClass.prototype.y = 2;
-
-function testParentClass() {
- var parentMock = goog.labs.mock(ParentClass);
-
- assertNotUndefined(parentMock.method1);
- assertUndefined(parentMock.method1());
- assertUndefined(parentMock.method2);
- assertUndefined(parentMock.x);
- assertUndefined(parentMock.y);
-}
-
-function testChildClass() {
- var childMock = goog.labs.mock(ChildClass);
-
- assertNotUndefined(childMock.method1);
- assertUndefined(childMock.method1());
- assertNotUndefined(childMock.method2);
- assertUndefined(childMock.method2());
- assertUndefined(childMock.x);
- assertUndefined(childMock.y);
-}
-
-function testParentClassInstance() {
- var parentMock = goog.labs.mock(new ParentClass());
-
- assertNotUndefined(parentMock.method1);
- assertUndefined(parentMock.method1());
- assertUndefined(parentMock.method2);
- assertUndefined(parentMock.x);
- assertUndefined(parentMock.y);
-}
-
-function testChildClassInstance() {
- var childMock = goog.labs.mock(new ChildClass());
-
- assertNotUndefined(childMock.method1);
- assertUndefined(childMock.method1());
- assertNotUndefined(childMock.method2);
- assertUndefined(childMock.method2());
- assertUndefined(childMock.x);
- assertUndefined(childMock.y);
-}
-
-function testNonEnumerableProperties() {
- var mockObject = goog.labs.mock({});
- assertNotUndefined(mockObject.toString);
- goog.labs.mock.when(mockObject).toString().then(function() {
- return 'toString';
- });
- assertEquals('toString', mockObject.toString());
-}
-
-function testBasicStubbing() {
- var obj = {
- method1: function(i) {
- return 2 * i;
- },
- method2: function(i, str) {
- return str;
- },
- method3: function(x) {
- return x;
- }
- };
-
- var mockObj = goog.labs.mock(obj);
- goog.labs.mock.when(mockObj).method1(2).then(function(i) {return i;});
-
- assertEquals(4, obj.method1(2));
- assertEquals(2, mockObj.method1(2));
- assertUndefined(mockObj.method1(4));
-
- goog.labs.mock.when(mockObj).method2(1, 'hi').then(function(i) {return 'oh'});
- assertEquals('hi', obj.method2(1, 'hi'));
- assertEquals('oh', mockObj.method2(1, 'hi'));
- assertUndefined(mockObj.method2(3, 'foo'));
-
- goog.labs.mock.when(mockObj).method3(4).thenReturn(10);
- assertEquals(4, obj.method3(4));
- assertEquals(10, mockObj.method3(4));
- assertUndefined(mockObj.method3(5));
-}
-
-</script>
-</body>
-</html>