diff --git a/src_nodejs/communication_fu.js b/src_nodejs/communication_fu.js index 9573c4c..9694418 100644 --- a/src_nodejs/communication_fu.js +++ b/src_nodejs/communication_fu.js @@ -42,9 +42,10 @@ const {Thrift} = require('thrift'); * - tokenization: reference to the Tokenization corresponding to tokenizationId * * @function concrete.communication.Communication.prototype.addInternalReferences - * @returns {object} Object with references to Communication-level maps (entityForUUID, etc.), - * mainly intended for TypeScript consumers. Regular JavaScript consumers can access these - * properties directly on the Communication. + * @returns {object} Object with references to Communication-level maps (entityForUUID, entityMentionForUUID, + * sectionForUUID, sentenceForUUID, situationForUUID, situationMentionForUUID, tokenizationForUUID), + * mainly intended for TypeScript consumers. JavaScript consumers can access these maps directly + * on the Communication. */ Communication.prototype.addInternalReferences = function() { this.entityForUUID = {}; diff --git a/test_nodejs/communication_fu_test.js b/test_nodejs/communication_fu_test.js new file mode 100644 index 0000000..9cce28e --- /dev/null +++ b/test_nodejs/communication_fu_test.js @@ -0,0 +1,23 @@ +const expect = require("chai").expect; + +const concrete = require("../dist_nodejs"); +const commJSONData = require('../test/fixtures/dog-bites-man.concrete.json'); + +describe("addInternalReferences", function() { + it("Returns Communication-level maps", function() { + const comm = new Communication(); + comm.initFromTJSONProtocolObject(commJSONData); + const refs = comm.addInternalReferences(); + expect( + comm.addInternalReferences() + ).to.have.all.keys([ + "entityForUUID", + "entityMentionForUUID", + "sectionForUUID", + "sentenceForUUID", + "situationForUUID", + "situationMentionForUUID", + "tokenizationForUUID" + ]); + }); +});