Skip to content

Commit cea6b23

Browse files
committed
AlchemyLanguage: integ test for date extraction
1 parent 20e102c commit cea6b23

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/test.alchemy_language.v1.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,24 @@ describe('alchemy_language', function() {
143143
assert.equal(body, qs.stringify({ html: 'sample text', outputMode: 'json'}));
144144
});
145145
});
146-
147146
})
147+
148+
describe('dates()', function() {
149+
var apiPath = '/text/TextExtractDates';
150+
151+
var payload = {
152+
text: 'Set a reminder for my appointment next Tuesday',
153+
anchorDate: '2016-03-22 00:00:00'
154+
};
155+
156+
it('should generate a valid payload', function() {
157+
var req = alchemy.dates(payload, noop);
158+
assert.equal(req.uri.href, service.url + apiPath + '?apikey=' + service.api_key);
159+
assert.equal(req.method, 'POST');
160+
assert(req.form);
161+
var body = new Buffer(req.body).toString('ascii');
162+
assert.equal(body, qs.stringify({ text: 'Set a reminder for my appointment next Tuesday', anchorDate: '2016-03-22 00:00:00', outputMode: 'json'}));
163+
});
164+
});
165+
148166
});

0 commit comments

Comments
 (0)