fix(evaluators): fix mathjs matrix output type (#5270)
Some checks failed
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
deploy client docs / Build (push) Has been cancelled

This commit is contained in:
Junyi 2024-09-14 19:40:45 +09:00 committed by GitHub
parent b4ee396b58
commit 00301815d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,16 @@
/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import mathjs from '../mathjs';
describe('evaluators > mathjs', () => {
it('matrix type should be to array', () => {
expect(mathjs('range(1, 3, 1)')).toEqual([1, 2, 3]);
});
});

View File

@ -20,6 +20,9 @@ export default evaluate.bind(
}
return math.round(result, 9);
}
if (result instanceof math.Matrix) {
return result.toArray();
}
return result;
},
{ replaceKey: true },