Merge pull request #14062 from Budibase/fix/date-js-test-failure
Fixing a date JS test case
This commit is contained in:
commit
dd4db8100f
|
@ -91,8 +91,13 @@ describe("jsRunner (using isolated-vm)", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("handle test case 2", async () => {
|
it("handle test case 2", async () => {
|
||||||
|
const todayDate = new Date()
|
||||||
|
// add a year and a month
|
||||||
|
todayDate.setMonth(new Date().getMonth() + 1)
|
||||||
|
todayDate.setFullYear(todayDate.getFullYear() + 1)
|
||||||
const context = {
|
const context = {
|
||||||
"Purchase Date": DATE,
|
"Purchase Date": DATE,
|
||||||
|
today: todayDate.toISOString(),
|
||||||
}
|
}
|
||||||
const result = await processJS(
|
const result = await processJS(
|
||||||
`
|
`
|
||||||
|
@ -100,7 +105,7 @@ describe("jsRunner (using isolated-vm)", () => {
|
||||||
let purchaseyear = purchase.getFullYear();
|
let purchaseyear = purchase.getFullYear();
|
||||||
let purchasemonth = purchase.getMonth();
|
let purchasemonth = purchase.getMonth();
|
||||||
|
|
||||||
var today = new Date ();
|
var today = new Date($("today"));
|
||||||
let todayyear = today.getFullYear();
|
let todayyear = today.getFullYear();
|
||||||
let todaymonth = today.getMonth();
|
let todaymonth = today.getMonth();
|
||||||
|
|
||||||
|
@ -113,7 +118,7 @@ describe("jsRunner (using isolated-vm)", () => {
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
expect(result).toBeDefined()
|
expect(result).toBeDefined()
|
||||||
expect(result).toBe(3)
|
expect(result).toBe(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should handle test case 3", async () => {
|
it("should handle test case 3", async () => {
|
||||||
|
|
Loading…
Reference in New Issue