Issue with `entity.setProperties`

Dear Datagrok team,

There seems to be an issue with entity.setProperties when using in TypeScript (working in native JavaScript).

Datagrok version: 1.12.2

Code to reproduce:
test(‘properties set/get’, async () => {
const project = DG.Project.create();
await grok.dapi.projects.save(project);

    const property = 'test';
    const analysisId = 'testid';
    const setProperties: Map<string, string> = new Map([
      [property, analysisId],
    ]);
    await project.setProperties(setProperties);
    const getProperties = await project.getProperties();
    expect(getProperties.get(property) === setProperties.get(property), true);
  });

Hello, thanks for reporting! I believe it’s related to this issue. As it was said, the signatures were wrong, and we changed them from Map to Object. The changes will be available in the new platform version. So please use something like this:

test('properties set/get', async () => {
    const project = DG.Project.create();
    await grok.dapi.projects.save(project);
    const setProperties = {test: 'testid'};
    await project.setProperties(setProperties);
    const getProperties = await project.getProperties();
    expect(getProperties.test === setProperties.test, true);
});

We have relevant tests, you can look at their structure at this link

3 Likes