Skip to content

Commit

Permalink
chore: add onlyFilesWithFlowAnnotation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Harvey authored and danharper committed Nov 27, 2016
1 parent 52b71f3 commit d311f22
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 8 deletions.
9 changes: 9 additions & 0 deletions tests/rules/assertions/booleanStyle.js
Expand Up @@ -29,6 +29,15 @@ export default {
{
code: 'type X = bool',
options: ['bool']
},
{
code: 'type X = bool',
options: ['boolean'],
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
8 changes: 8 additions & 0 deletions tests/rules/assertions/noDupeKeys.js
Expand Up @@ -12,6 +12,14 @@ export default {
valid: [
{
code: 'type FooType = { a: number, b: string, c: number }'
},
{
code: 'type FooType = { a: number, b: string, a: number }',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
8 changes: 8 additions & 0 deletions tests/rules/assertions/noWeakTypes.js
Expand Up @@ -246,6 +246,14 @@ export default {
{
code: 'type X = Function',
options: [{Function: false}]
},
{
code: 'function foo(thing): Function {}',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
9 changes: 9 additions & 0 deletions tests/rules/assertions/objectTypeDelimiter.js
Expand Up @@ -142,6 +142,15 @@ export default {
{
code: 'declare class Foo { (): Foo, }',
options: ['comma']
},
{
code: 'type Foo = { a: Foo, b: Bar }',
options: ['semicolon'],
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
8 changes: 8 additions & 0 deletions tests/rules/assertions/requireParameterType.js
Expand Up @@ -190,6 +190,14 @@ export default {
excludeParameterMatch: '^_'
}
]
},
{
code: '(foo) => {}',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
8 changes: 8 additions & 0 deletions tests/rules/assertions/semi.js
Expand Up @@ -50,6 +50,14 @@ export default {
{
code: 'type FooType = {}',
options: ['never']
},
{
code: 'type FooType = {}',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
8 changes: 8 additions & 0 deletions tests/rules/assertions/sortKeys.js
Expand Up @@ -79,6 +79,14 @@ export default {
{
code: 'type FooType = { 1:number, 2: number, 10: number }',
options: ['asc', {natural: true}]
},
{
code: 'type FooType = { b: number, a: number }',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
8 changes: 8 additions & 0 deletions tests/rules/assertions/typeIdMatch.js
Expand Up @@ -29,6 +29,14 @@ export default {
options: [
'^foo$'
]
},
{
code: 'type foo = {};',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
32 changes: 24 additions & 8 deletions tests/rules/assertions/unionIntersectionSpacing.js
Expand Up @@ -74,10 +74,10 @@ const UNION = {
}
],
valid: [
{code: 'type X = string | number;'},
{code: 'type X = string | number | boolean;'},
{code: 'type X = (string) | number;'},
{code: 'type X = ((string)) | (number | foo);'},
{code: 'type X = string | number;'},
{code: 'type X = string | number | boolean;'},
{code: 'type X = (string) | number;'},
{code: 'type X = ((string)) | (number | foo);'},
{
code: 'type X = string|number',
options: ['never']
Expand All @@ -93,6 +93,14 @@ const UNION = {
'| number',
'}'
].join('\n')
},
{
code: 'type X = string| number;',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
Expand Down Expand Up @@ -173,10 +181,10 @@ const INTERSECTION = {
}
],
valid: [
{code: 'type X = string & number;'},
{code: 'type X = string & number & boolean;'},
{code: 'type X = (string) & number;'},
{code: 'type X = ((string)) & (number & foo);'},
{code: 'type X = string & number;'},
{code: 'type X = string & number & boolean;'},
{code: 'type X = (string) & number;'},
{code: 'type X = ((string)) & (number & foo);'},
{
code: 'type X = string&number',
options: ['never']
Expand All @@ -192,6 +200,14 @@ const INTERSECTION = {
'& number',
'}'
].join('\n')
},
{
code: 'type X = string& number;',
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true
}
}
}
]
};
Expand Down

0 comments on commit d311f22

Please sign in to comment.