Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
Fixes #123
Fixes #124
  • Loading branch information
coderbyheart committed Dec 19, 2022
1 parent ff16949 commit d1a635e
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 105 deletions.
110 changes: 68 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@
"express": "4.18.2",
"fast-equals": "4.0.3",
"id128": "1.6.6",
"jsonata": "1.8.6",
"jsonata": "2.0.0",
"nodemailer": "6.8.0",
"nodemon": "2.0.20",
"passport": "0.6.0",
"passport-cookie": "1.0.9"
},
"devDependencies": {
"@nordicsemiconductor/asset-tracker-cloud-code-style": "11.0.159",
"@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript": "10.0.57",
"@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript": "10.0.58",
"@swc/core": "1.3.23",
"@swc/jest": "0.2.24",
"@types/body-parser": "1.19.2",
"@types/compression": "1.7.2",
"@types/cookie-parser": "1.4.3",
"@types/cors": "^2.8.13",
"@types/express": "4.17.14",
"@types/express": "4.17.15",
"@types/jest": "29.2.4",
"@types/lodash": "4.14.191",
"@types/node": "18.11.17",
Expand Down
4 changes: 2 additions & 2 deletions src/form/evaluateJSONataExpression.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { evaluateJSONataExpression } from './evaluateJSONataExpression.js'

describe('evaluateJSONataExpression', () => {
it('should evaluate a expression', () =>
it('should evaluate a expression', async () =>
expect(
evaluateJSONataExpression({
expression: `$not('food items' in whomYouServe.aidTypes)`,
Expand All @@ -11,5 +11,5 @@ describe('evaluateJSONataExpression', () => {
},
},
}),
).toEqual(false))
).resolves.toEqual(false))
})
6 changes: 3 additions & 3 deletions src/form/evaluateJSONataExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Static } from '@sinclair/typebox'
import jsonata from 'jsonata'
import { Response } from './submission.js'

export const evaluateJSONataExpression = ({
export const evaluateJSONataExpression = async ({
expression,
response,
debug,
Expand All @@ -12,11 +12,11 @@ export const evaluateJSONataExpression = ({
response: Static<typeof Response>
debug?: typeof console.debug
error?: typeof console.error
}): boolean => {
}): Promise<boolean> => {
let result: boolean
try {
const compileExpression = jsonata(expression)
result = compileExpression.evaluate(response)
result = await compileExpression.evaluate(response)
} catch (err) {
error?.(`[jsonata]`, `failed to evaluate expression`, err)
return false
Expand Down
9 changes: 4 additions & 5 deletions src/form/responseToTSV.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ additional.other Is there anything else you would like to communicate with us at
additional.logoUsage Thank you for your time! If you'd like, we'll be highlighting some of the organisations that filled out the needs assessment in recognition of the important work being done by grassroots organisations. Your data will not be tied to you publicly. Instead we may, for example, put your organisation's name and logo on the report. If you do not opt in, we will not do this. If you are the only organisation to respond from your region, we will not do this. Do you give us permission to highlight your contribution by putting your name and logo on the report? no no`

describe('responseToTSV()', () => {
it('should convert the response to TSV', () => {
it('should convert the response to TSV', async () =>
expect(
responseToTSV(
response,
Expand All @@ -122,9 +122,8 @@ describe('responseToTSV()', () => {
$id: new URL(`https://example.com/form/${ulid()}`),
}),
),
).toEqual(tsv)
})
it('should convert a response with line breaks to CSV (#48)', () =>
).resolves.toEqual(tsv))
it('should convert a response with line breaks to CSV (#48)', async () =>
expect(
responseToTSV(
{
Expand Down Expand Up @@ -156,7 +155,7 @@ describe('responseToTSV()', () => {
],
},
),
).toEqual(
).resolves.toEqual(
[
[
'Question',
Expand Down
Loading

0 comments on commit d1a635e

Please sign in to comment.