PR feedback: object type, test

This commit is contained in:
Beth Brennan
2023-01-09 10:38:47 -05:00
parent b68ac91a69
commit 3922df3106
2 changed files with 19 additions and 19 deletions
@@ -75,8 +75,8 @@ function getEventContext(workflowContext: WorkflowContext): ExpressionData {
}
const events = Object.keys(eventsConfig);
for (let e of events) {
let payload = eventPayloads[e];
for (const e of events) {
const payload = eventPayloads[e];
if (payload) {
merge(d, payload);
}
@@ -85,9 +85,8 @@ function getEventContext(workflowContext: WorkflowContext): ExpressionData {
return d;
}
function merge(d: data.Dictionary, toAdd: any): data.Dictionary {
for (let key of Object.keys(toAdd)) {
const value = toAdd[key];
function merge(d: data.Dictionary, toAdd: Object): data.Dictionary {
for (const [key, value] of Object.entries(toAdd)) {
if (value && typeof value === "object" && !d.get(key)) {
d.add(key, merge(new data.Dictionary(), value));
} else {
@@ -207,19 +207,19 @@ jobs:
expect(result).toEqual([
{
"message": "Context access might be invalid: foo",
"range": {
"end": {
"character": 41,
"line": 5,
},
"start": {
"character": 25,
"line": 5,
message: "Context access might be invalid: foo",
range: {
end: {
character: 41,
line: 5
},
start: {
character: 25,
line: 5
}
},
"severity": 2,
},
severity: 2
}
]);
});
@@ -1133,13 +1133,14 @@ jobs:
it("validates event payload", async () => {
const input = `
on: push
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo \${{ github.event.forced }}
- run: echo \${{ github.event.pull_request }}
- run: echo \${{ github.event.schedule }}
`;
@@ -1151,11 +1152,11 @@ jobs:
range: {
end: {
character: 46,
line: 8
line: 9
},
start: {
character: 18,
line: 8
line: 9
}
},
severity: DiagnosticSeverity.Warning