Skip to content

Commit 67bddc3

Browse files
authored
Update tests flatten array (#2675)
[no important files changed] * Syncing toml file * Updating test file * Updating the json file
1 parent 36001d7 commit 67bddc3

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

exercises/practice/flatten-array/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"contributors": [
66
"ankorGH",
77
"gabriel376",
8+
"jagdish-15",
89
"rchavarria",
910
"SleeplessByte",
1011
"tejasbubane",
Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
11+
12+
[8c71dabd-da60-422d-a290-4a571471fb14]
13+
description = "empty"
414

515
[d268b919-963c-442d-9f07-82b93f1b518c]
616
description = "no nesting"
717

18+
[3f15bede-c856-479e-bb71-1684b20c6a30]
19+
description = "flattens a nested array"
20+
821
[c84440cc-bb3a-48a6-862c-94cf23f2815d]
922
description = "flattens array with just integers present"
1023

@@ -14,8 +27,37 @@ description = "5 level nesting"
1427
[d572bdba-c127-43ed-bdcd-6222ac83d9f7]
1528
description = "6 level nesting"
1629

30+
[0705a8e5-dc86-4cec-8909-150c5e54fa9c]
31+
description = "null values are omitted from the final result"
32+
33+
[c6cf26de-8ccd-4410-84bd-b9efd88fd2bc]
34+
description = "consecutive null values at the front of the list are omitted from the final result"
35+
include = false
36+
37+
[bc72da10-5f55-4ada-baf3-50e4da02ec8e]
38+
description = "consecutive null values at the front of the array are omitted from the final result"
39+
reimplements = "c6cf26de-8ccd-4410-84bd-b9efd88fd2bc"
40+
41+
[382c5242-587e-4577-b8ce-a5fb51e385a1]
42+
description = "consecutive null values in the middle of the list are omitted from the final result"
43+
include = false
44+
45+
[6991836d-0d9b-4703-80a0-3f1f23eb5981]
46+
description = "consecutive null values in the middle of the array are omitted from the final result"
47+
reimplements = "382c5242-587e-4577-b8ce-a5fb51e385a1"
48+
1749
[ef1d4790-1b1e-4939-a179-51ace0829dbd]
1850
description = "6 level nest list with null values"
51+
include = false
52+
53+
[dc90a09c-5376-449c-a7b3-c2d20d540069]
54+
description = "6 level nested array with null values"
55+
reimplements = "ef1d4790-1b1e-4939-a179-51ace0829dbd"
1956

2057
[85721643-705a-4150-93ab-7ae398e2942d]
2158
description = "all values in nested list are null"
59+
include = false
60+
61+
[51f5d9af-8f7f-4fb5-a156-69e8282cb275]
62+
description = "all values in nested array are null"
63+
reimplements = "85721643-705a-4150-93ab-7ae398e2942d"

exercises/practice/flatten-array/flatten-array.spec.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@ describe('FlattenArray', () => {
4040
expect(flatten([1, 2, null])).toEqual([1, 2]);
4141
});
4242

43-
xtest('6 level nest list with null values', () => {
43+
xtest('consecutive null values at the front of the array are omitted from the final result', () => {
44+
expect(flatten([null, null, 3])).toEqual([3]);
45+
});
46+
47+
xtest('consecutive null values in the middle of the array are omitted from the final result', () => {
48+
expect(flatten([1, null, null, 4])).toEqual([1, 4]);
49+
});
50+
51+
xtest('6 level nested array with null values', () => {
4452
expect(flatten([0, 2, [[2, 3], 8, [[100]], null, [[null]]], -2])).toEqual([
4553
0, 2, 2, 3, 8, 100, -2,
4654
]);
4755
});
4856

49-
xtest('all values in nested list are null', () => {
57+
xtest('all values in nested array are null', () => {
5058
expect(
5159
flatten([null, [[[null]]], null, null, [[null, null], null], null]),
5260
).toEqual([]);

0 commit comments

Comments
 (0)