aboutsummaryrefslogtreecommitdiff
path: root/js/proto3_test.js
diff options
context:
space:
mode:
authorAdam Cozzette <acozzette@google.com>2018-11-09 11:28:22 -0800
committerAdam Cozzette <acozzette@google.com>2018-11-09 11:28:22 -0800
commit0894e07536af88065d462cdc9d8e807c0723ef4d (patch)
treec36164c9042a389e481b3fd13d887ab1c65fe91f /js/proto3_test.js
parentd52f2bb9e45f6f92743ef632add29f6b15832d3b (diff)
downloadprotobuf-0894e07536af88065d462cdc9d8e807c0723ef4d.tar.gz
Integrated internal changes from Google
Diffstat (limited to 'js/proto3_test.js')
-rw-r--r--js/proto3_test.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/proto3_test.js b/js/proto3_test.js
index 4aed88baa..7f9d71d3f 100644
--- a/js/proto3_test.js
+++ b/js/proto3_test.js
@@ -30,17 +30,15 @@
goog.require('goog.crypt.base64');
goog.require('goog.testing.asserts');
-
// CommonJS-LoadFromFile: testbinary_pb proto.jspb.test
goog.require('proto.jspb.test.ForeignMessage');
-
// CommonJS-LoadFromFile: proto3_test_pb proto.jspb.test
goog.require('proto.jspb.test.Proto3Enum');
goog.require('proto.jspb.test.TestProto3');
-
+// CommonJS-LoadFromFile: google/protobuf/any_pb proto.google.protobuf
+goog.require('proto.google.protobuf.Any');
// CommonJS-LoadFromFile: google/protobuf/timestamp_pb proto.google.protobuf
goog.require('proto.google.protobuf.Timestamp');
-
// CommonJS-LoadFromFile: google/protobuf/struct_pb proto.google.protobuf
goog.require('proto.google.protobuf.Struct');
@@ -377,6 +375,7 @@ describe('proto3Test', function() {
});
+
it('testTimestampWellKnownType', function() {
var msg = new proto.google.protobuf.Timestamp();
msg.fromDate(new Date(123456789));
@@ -384,6 +383,9 @@ describe('proto3Test', function() {
assertEquals(789000000, msg.getNanos());
var date = msg.toDate();
assertEquals(123456789, date.getTime());
+ var anotherMsg = proto.google.protobuf.Timestamp.fromDate(date);
+ assertEquals(msg.getSeconds(), anotherMsg.getSeconds());
+ assertEquals(msg.getNanos(), anotherMsg.getNanos());
});
it('testStructWellKnownType', function() {