Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add tests about missing getter property
Related #174
  • Loading branch information
LoicMahieu committed Aug 23, 2023
commit c04d1e8d007b4abe203d388a40668c27f2073733
43 changes: 43 additions & 0 deletions test/test.class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {checkBuiltInVMAndNodeVM} from '../test-helpers/checkVM.js';

checkBuiltInVMAndNodeVM(function (vmType, setBuiltInState) {
describe(`JSONPath - Properties (${vmType})`, function () {
before(setBuiltInState);

/**
*
*/
class Test1 {
/**
* Test2.
*/
constructor () {
this.test2 = "test2";
}

/**
* Test3.
* @returns {string}
*/
// eslint-disable-next-line class-methods-use-this
get test3 () {
return "test3";
}
}
const json = new Test1();

it("Checking simple property", () => {
assert.equal(
jsonpath({json, path: "$.test2", wrap: false}),
"test2"
);
});

it("Checking getter property", () => {
assert.equal(
jsonpath({json, path: "$.test3", wrap: false}),
"test3"
);
});
});
});