Skip to content

Commit

Permalink
Revert "@W-15920576 Jh/bug fix string null validation (#269)" (#272)
Browse files Browse the repository at this point in the history
This reverts commit 84e509f.
  • Loading branch information
jonnyhork authored Jun 12, 2024
1 parent 4357e28 commit b6696a2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
3 changes: 1 addition & 2 deletions packages/soql-builder-ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"@lwc/lwc/no-async-operation": "off",
"@lwc/lwc/no-inner-html": "warn",
"@lwc/lwc/no-document-query": "warn",
"no-underscore-dangle": "off",
"@typescript-eslint/no-unused-vars": "warn"
"no-underscore-dangle": "off"
}
}
2 changes: 1 addition & 1 deletion packages/soql-builder-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"license": "BSD-3-Clause",
"main": "dist/",
"scripts": {
"build": "export NODE_OPTIONS=--openssl-legacy-provider && lwc-services build -w webpack.config.js -m production",
"build": "lwc-services build -w webpack.config.js -m production",
"clean": "shx rm -rf package-lock.json && shx rm -rf dist && shx rm -rf node_modules",
"publish:lwc": "npm publish .",
"lint": "eslint ./src",
Expand Down
1 change: 0 additions & 1 deletion packages/soql-builder-ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
{}
7 changes: 0 additions & 7 deletions packages/soql-model/src/validators/stringValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@ describe('StringValidator should', () => {
it('return valid result for string in single quotes', () => {
expect(validator.validate("'foo'")).toEqual(validResult);
});

it('return valid result when user input is NULL or null', () => {
expect(validator.validate("'null'")).toEqual(validResult);
expect(validator.validate("'NULL'")).toEqual(validResult);
});

it('return not valid result for non-string value', () => {
expect(validator.validate('foo')).toEqual(notValidResult);
});

it('return not valid result for string ending in escaped quote', () => {
expect(validator.validate("'foo\\'")).toEqual(notValidResult);
});
Expand Down
9 changes: 4 additions & 5 deletions packages/soql-model/src/validators/stringValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import { ValidateResult, Validator } from './validator';
export class StringValidator extends Validator {
public validate(input: string): ValidateResult {
const isValid =
(input.length >= 2 &&
input.startsWith("'") &&
input.endsWith("'") &&
!this.isEscaped(input.substring(1, input.length - 1))) ||
input.toLowerCase() === 'null';
input.length >= 2 &&
input.startsWith("'") &&
input.endsWith("'") &&
!this.isEscaped(input.substring(1, input.length - 1));
const message = isValid ? undefined : Messages.error_fieldInput_string;
return { isValid, message };
}
Expand Down

0 comments on commit b6696a2

Please sign in to comment.