Skip to content

Commit

Permalink
tests: Add output to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed May 11, 2020
1 parent 93374cd commit 7133483
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/rules/assertions/arrayStyleSimpleType.js
Expand Up @@ -58,6 +58,7 @@ export default {
{message: 'Use "Array<string[]>", not "string[][]"'},
{message: 'Use "Array<string>", not "string[]"'},
],
output: 'type X = Array<string[]>',
},
{
code: 'type X = Promise<{\n foo: string,\n bar: number\n}>[]',
Expand Down
1 change: 1 addition & 0 deletions tests/rules/assertions/requireIndexerName.js
Expand Up @@ -5,6 +5,7 @@ export default {
errors: [
{message: 'All indexers must be declared with key name.'},
],
output: 'type foo = { [key: string]: number };',
},
],
valid: [
Expand Down
7 changes: 7 additions & 0 deletions tests/rules/assertions/requireValidFileAnnotation.js
Expand Up @@ -66,6 +66,7 @@ export default {
options: [
'always',
],
output: '// @flow\na;'
},
{
code: '/* @flow */',
Expand All @@ -80,6 +81,7 @@ export default {
annotationStyle: 'line',
},
],
output: '// @flow',
},
{
code: '// @flow',
Expand All @@ -94,6 +96,7 @@ export default {
annotationStyle: 'block',
},
],
output: '/* @flow */',
},
{
code: '// @flow',
Expand All @@ -108,6 +111,7 @@ export default {
annotationStyle: 'block',
},
],
output: '/* @flow */',
},
{
code: '// @flow',
Expand All @@ -123,6 +127,7 @@ export default {
strict: true,
},
],
output: '// @flow strict',
},
{
code: '/* @noflow */',
Expand All @@ -137,6 +142,7 @@ export default {
annotationStyle: 'line',
},
],
output: '// @noflow',
},
{
code: '// @noflow',
Expand All @@ -151,6 +157,7 @@ export default {
annotationStyle: 'block',
},
],
output: '/* @noflow */',
},
{
code: 'a;',
Expand Down
9 changes: 9 additions & 0 deletions tests/rules/assertions/sortKeys.js
Expand Up @@ -3,44 +3,53 @@ export default {
{
code: 'type FooType = { a: number, c: number, b: string }',
errors: [{message: 'Expected type annotations to be in ascending order. "b" should be before "c".'}],
output: 'type FooType = { a: number, b: string, c: number }',
},
{
code: 'type FooType = { a: number, b: number, C: number }',
errors: [{message: 'Expected type annotations to be in ascending order. "C" should be before "b".'}],
output: 'type FooType = { C: number, a: number, b: number }',
},
{
code: 'type FooType = { 1: number, 2: number, 10: number }',
errors: [{message: 'Expected type annotations to be in ascending order. "10" should be before "2".'}],
output: 'type FooType = { 1: number, 10: number, 2: number }',
},
{
code: 'type FooType = { a: number, b: number }',
errors: [{message: 'Expected type annotations to be in descending order. "b" should be before "a".'}],
options: ['desc'],
output: 'type FooType = { b: number, a: number }',
},
{
code: 'type FooType = { C: number, b: number, a: string }',
errors: [{message: 'Expected type annotations to be in descending order. "b" should be before "C".'}],
options: ['desc'],
output: 'type FooType = { b: number, a: string, C: number }',
},
{
code: 'type FooType = { 10: number, 2: number, 1: number }',
errors: [{message: 'Expected type annotations to be in descending order. "2" should be before "10".'}],
options: ['desc'],
output: 'type FooType = { 2: number, 10: number, 1: number }',
},
{
code: 'type FooType = { a: number, c: number, C: number, b: string }',
errors: [{message: 'Expected type annotations to be in insensitive ascending order. "b" should be before "C".'}],
options: ['asc', {caseSensitive: false}],
output: 'type FooType = { a: number, b: string, c: number, C: number }',
},
{
code: 'type FooType = { a: number, C: number, c: number, b: string }',
errors: [{message: 'Expected type annotations to be in insensitive ascending order. "b" should be before "c".'}],
options: ['asc', {caseSensitive: false}],
output: 'type FooType = { a: number, b: string, C: number, c: number }',
},
{
code: 'type FooType = { 1: number, 10: number, 2: boolean }',
errors: [{message: 'Expected type annotations to be in natural ascending order. "2" should be before "10".'}],
options: ['asc', {natural: true}],
output: 'type FooType = { 1: number, 2: boolean, 10: number }',
},
{
code: 'type FooType = { a: number, c: number, b: string }',
Expand Down

0 comments on commit 7133483

Please sign in to comment.