From c2d23ef120c52733de208e5ff0e30a70743a6f29 Mon Sep 17 00:00:00 2001 From: Matt Phillips Date: Tue, 12 Jun 2018 10:51:33 +0100 Subject: [PATCH 1/3] Add 1 dimensional array docs --- docs/GlobalAPI.md | 2 ++ packages/jest-each/README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index 049cf3ec692f..f42d0e630667 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -231,6 +231,7 @@ Use `describe.each` if you keep duplicating the same test suites with different #### 1. `describe.each(table)(name, fn)` - `table`: `Array` of Arrays with the arguments that are passed into the `fn` for each row. + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` - `name`: `String` the title of the test suite. - Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args): - `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format). @@ -476,6 +477,7 @@ Use `test.each` if you keep duplicating the same test with different data. `test #### 1. `test.each(table)(name, fn)` - `table`: `Array` of Arrays with the arguments that are passed into the test `fn` for each row. + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` - `name`: `String` the title of the test block. - Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args): - `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format). diff --git a/packages/jest-each/README.md b/packages/jest-each/README.md index 08b2994837f5..79b752f0ecf4 100644 --- a/packages/jest-each/README.md +++ b/packages/jest-each/README.md @@ -96,6 +96,7 @@ const each = require('jest-each'); ##### `each`: - parameters: `Array` of Arrays with the arguments that are passed into the `testFn` for each row + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` ##### `.test`: @@ -116,6 +117,7 @@ const each = require('jest-each'); ##### `each`: - parameters: `Array` of Arrays with the arguments that are passed into the `suiteFn` for each row + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` ##### `.describe`: From f2c6800040d796a3baf7e7ad15847c047e0cd6a2 Mon Sep 17 00:00:00 2001 From: Matt Phillips Date: Tue, 12 Jun 2018 10:54:54 +0100 Subject: [PATCH 2/3] Add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82fa07a9290d..72b2a46da94f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - `[expect]` Using symbolic property names in arrays no longer causes the `toEqual` matcher to fail ([#6391](https://github.com/facebook/jest/pull/6391)) - `[expect]` `toEqual` no longer tries to compare non-enumerable symbolic properties, to be consistent with non-symbolic properties. ([#6398](https://github.com/facebook/jest/pull/6398)) +### Chore & Maintenance + +- `[docs]` Add jest-each docs for 1 dimensional arrays ([#6444](https://github.com/facebook/jest/pull/6444/files)) + ## 23.1.0 ### Features From 4c4f67fa85fd0441695660b82d2fc82d9e5bdc46 Mon Sep 17 00:00:00 2001 From: Matt Phillips Date: Tue, 12 Jun 2018 11:00:20 +0100 Subject: [PATCH 3/3] Fix linting --- docs/GlobalAPI.md | 4 ++-- packages/jest-each/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index f42d0e630667..55e8c08c369c 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -231,7 +231,7 @@ Use `describe.each` if you keep duplicating the same test suites with different #### 1. `describe.each(table)(name, fn)` - `table`: `Array` of Arrays with the arguments that are passed into the `fn` for each row. - - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` - `name`: `String` the title of the test suite. - Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args): - `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format). @@ -477,7 +477,7 @@ Use `test.each` if you keep duplicating the same test with different data. `test #### 1. `test.each(table)(name, fn)` - `table`: `Array` of Arrays with the arguments that are passed into the test `fn` for each row. - - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` - `name`: `String` the title of the test block. - Generate unique test titles by positionally injecting parameters with [`printf` formatting](https://nodejs.org/api/util.html#util_util_format_format_args): - `%p` - [pretty-format](https://www.npmjs.com/package/pretty-format). diff --git a/packages/jest-each/README.md b/packages/jest-each/README.md index 79b752f0ecf4..d932cbaac14b 100644 --- a/packages/jest-each/README.md +++ b/packages/jest-each/README.md @@ -96,7 +96,7 @@ const each = require('jest-each'); ##### `each`: - parameters: `Array` of Arrays with the arguments that are passed into the `testFn` for each row - - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` ##### `.test`: @@ -117,7 +117,7 @@ const each = require('jest-each'); ##### `each`: - parameters: `Array` of Arrays with the arguments that are passed into the `suiteFn` for each row - - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` + - _Note_ If you pass in a 1D array of primitives, internally it will be mapped to a table i.e. `[1, 2, 3] -> [[1], [2], [3]]` ##### `.describe`: