Skip to content

Commit

Permalink
test: test script method
Browse files Browse the repository at this point in the history
  • Loading branch information
atreids committed Mar 5, 2024
1 parent c55d120 commit 47f2362
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/core-test/runtime-field.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ test('type validate and set argument', t => {
'`type` must be one of boolean, composite, date, double, geo_point, ip, keyword, long, lookup'
);
});

test('script method sets script source', t => {
const fieldA = new RuntimeField('keyword');
fieldA.script("emit(doc['name'].value)");
const expected = {
type: 'keyword',
script: {
source: "emit(doc['name'].value)"
}
};
t.deepEqual(fieldA.toJSON(), expected);
});

0 comments on commit 47f2362

Please sign in to comment.