This is a phenomenally upgraded prompt—and you nailed the Fix the Prompt challenge. Let’s break it down 👇
"As a experienced security advisor review my code... [etc.]"
describe('case insensitive word to key', () => { | |
test.each([ | |
["A", "a"], | |
["Hello", "hello"], | |
["WORLD", "world"], | |
["MiXeDcAsE", "mixedcase"], | |
["PiPa", "pipa"], | |
["CHACHA", "chacha"], | |
["Hello123", "hello123"], | |
[" Space ", " space "], |
export class CaseInsensitiveWordToKey implements WordToKey { | |
getKey(word: string): string { | |
return word.toLowerCase(); | |
} | |
} |
describe('case insensitive word to key', () => { | |
test.each([ | |
["A", "a"], | |
["PiPa", "pipa"], | |
])('converts %s to key %s', (word, expectedKey) => { | |
const wordToKey = new CaseInsensitiveWordToKey(); | |
const result = wordToKey.getKey(word); | |
expect(result).toEqual(expectedKey); | |
}); | |
}); |
describe('case insensitive word to key', () => { | |
test.each([ | |
["A", "a"], | |
])('converts %s to key %s', (word, expectedKey) => { | |
const wordToKey = new CaseInsensitiveWordToKey(); | |
const result = wordToKey.getKey(word); | |
expect(result).toEqual(expectedKey); | |
}); | |
}); |
describe('case insensitive word to key', () => { | |
it("keys are only lower case", () => { | |
const wordToKey = new CaseInsensitiveWordToKey(); | |
const result = wordToKey.getKey("A"); | |
expect(result).toEqual("a"); | |
}); | |
}) |
[TestCase("12345678Z")] | |
[TestCase("87654321X")] | |
[TestCase("11223344B")] | |
[TestCase("56838246W")] | |
[TestCase("72841539P")] | |
[TestCase("23456789T")] | |
public void Can_Create_User_Account_When_Valid_Dni_Is_Provided(string validDni) | |
{ | |
var userWithValidDni = new UserData( | |
new Id(validDni), |
[Test] | |
public void Can_Create_User_Account_When_Valid_Dni_Is_Provided() | |
{ | |
const string validDni = "12345678Z"; | |
var userWithValidDni = new UserData( | |
new Id(validDni), | |
Name, | |
ValidCreditCardNumber | |
); | |
The prompt:
As a experienced security advisor review my code and highlight possible vulnerabilities.
For each vulnerability you find, tell me its location (path, file and line), and explain why it's a problem.
Since I'm learning about this topic explain to me any non basic term or concept you use and point to sources where I can check them.
Ask me any questions you think necessary about my code (between 0 and 7) in order to improve your analysys,