From fe78283b9230252efe5eb016f2afb09dd301ea35 Mon Sep 17 00:00:00 2001 From: Eddie Antonio Santos Date: Fri, 30 Nov 2018 13:07:50 -0700 Subject: [PATCH] Test integration of initialize() in LMLayer and Worker. --- .../in_browser/cases/top-level-lmlayer.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/common/predictive-text/unit_tests/in_browser/cases/top-level-lmlayer.js b/common/predictive-text/unit_tests/in_browser/cases/top-level-lmlayer.js index f995fc1d20..76e2799c97 100644 --- a/common/predictive-text/unit_tests/in_browser/cases/top-level-lmlayer.js +++ b/common/predictive-text/unit_tests/in_browser/cases/top-level-lmlayer.js @@ -2,10 +2,24 @@ var assert = chai.assert; describe('LMLayer', function () { describe('[[constructor]]', function () { - it('should construct with zero arguments', function () { - let lmlayer = new LMLayer(); - assert.instanceOf(lmlayer, LMLayer); + it('should construct with zero arguments', function () { + let lmLayer = new LMLayer(); + assert.instanceOf(lmLayer, LMLayer); + }); + }); + + describe('#initialize()', function () { + it('should yield a reasonable configuration', function () { + let maxLeftContext = 64; + let lmLayer = new LMLayer(); + return lmLayer.initialize( + { maxLeftContextCodeUnits: maxLeftContext }, + { model: { kind: 'wordlist', words: ['foo', 'bar']} } + ).then(function (configuration) { + assert.isAtMost(configuration.leftContextCodeUnits, maxLeftContext); + assert.propertyVal(configuration, 'rightContextCodeUnits', 0); }); + }); }); describe('#asBlobURI()', function () {