From 508aaf22ec4b6270bbc1f0d340d4e78e93a9ca05 Mon Sep 17 00:00:00 2001 From: Shikhar Yadav <92710243+shikharyadav16@users.noreply.github.com> Date: Mon, 30 Mar 2026 16:06:50 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20Enhancement:=20Add=20test=20case=20for?= =?UTF-8?q?=20null=20containerId=20validation=20in=20cargo=20m=E2=80=A6=20?= =?UTF-8?q?(#66679)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../69a56b5069ca99f7317e6e19.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/curriculum/challenges/english/blocks/lab-cargo-manifest-validator/69a56b5069ca99f7317e6e19.md b/curriculum/challenges/english/blocks/lab-cargo-manifest-validator/69a56b5069ca99f7317e6e19.md index 7ed0a6f8a7e..6ca69f85f64 100644 --- a/curriculum/challenges/english/blocks/lab-cargo-manifest-validator/69a56b5069ca99f7317e6e19.md +++ b/curriculum/challenges/english/blocks/lab-cargo-manifest-validator/69a56b5069ca99f7317e6e19.md @@ -262,6 +262,7 @@ Calling `validateManifest()` with `{}` should return the new object `{ container ```js const testObj = { + }; const expected = { @@ -279,6 +280,27 @@ assert.notStrictEqual(copy, testObj, "validateManifest() should return a new obj assert.equal(Object.keys(testObj).length, 0, "validateManifest() should return a new object, not mutate the original") ``` +Calling `validateManifest()` with `{ containerId: null, destination: "Santa Cruz", weight: 304, unit: "kg", hazmat: false }` should return the new object `{ containerId: "Invalid" }` without mutating the source input. + +```js +const testObj = { + containerId: null, + destination: "Santa Cruz", + weight: 304, + unit: "kg", + hazmat: false +}; + +const expected = { + containerId: "Invalid" +}; + +const copy = validateManifest(testObj); +assert.isObject(copy); +assert.deepEqual(copy, expected, "validateManifest() did not return the expected object for null containerId"); +assert.notStrictEqual(copy, testObj, "validateManifest() should return a new object, not mutate the original"); +``` + Calling `validateManifest()` with `{ containerId: 0, destination: 405, weight: -84, unit: "pounds", hazmat: "no" }` should return the new object `{ containerId: "Invalid", destination: "Invalid", weight: "Invalid", unit: "Invalid", hazmat: "Invalid" }` without mutating the source input. ```js