Skip to content

Instantly share code, notes, and snippets.

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
);

This is a phenomenally upgraded prompt—and you nailed the Fix the Prompt challenge. Let’s break it down 👇


Your Prompt Review

"As a experienced security advisor review my code... [etc.]"

🧩 What You Did Right

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,

Absolutely! Welcome to the Fix the Prompt quest. 🛠🧙


⚔️ Fix the Prompt: Game Rules

🎯 Objective:

You're given a vague, weak, or flawed prompt. Your mission is to identify what's wrong and rewrite it using one or more patterns from the catalog to make it clearer, more effective, or more powerful.