@@ -4,7 +4,7 @@ import { DEFAULT_OVERRIDE_CONFIG } from '../../helpers/constants'
4
4
import { checkFunctionSize , reportFunctionSize } from './functionSize'
5
5
6
6
describe ( 'checkFunctionSize' , ( ) => {
7
- it ( 'should not report files where functions do not exceed the recommended limit' , ( ) => {
7
+ it ( 'should not report files where functions do not exceed the limit' , ( ) => {
8
8
const script = {
9
9
content : `
10
10
<script setup>
@@ -28,7 +28,7 @@ describe('checkFunctionSize', () => {
28
28
expect ( result ) . toStrictEqual ( [ ] )
29
29
} )
30
30
31
- it ( 'should not report files where arrow functions without curly braces do not exceed the recommended limit' , ( ) => {
31
+ it ( 'should not report files where arrow functions without curly braces do not exceed the limit' , ( ) => {
32
32
const script = {
33
33
content : `
34
34
<script setup>
@@ -53,6 +53,45 @@ describe('checkFunctionSize', () => {
53
53
expect ( result ) . toStrictEqual ( [ ] )
54
54
} )
55
55
56
+ it . todo ( 'should not report files where no function exceeds the limit' , ( ) => {
57
+ const script = {
58
+ content : `
59
+ <script setup>
60
+ const sum = (a, b) => a + b
61
+
62
+ const someVal = 100
63
+
64
+ function func() {
65
+ // ...
66
+ // ...
67
+ // ...
68
+ // ...
69
+ // ...
70
+ // ...
71
+ // ...
72
+ // ...
73
+ // ...
74
+ // ...
75
+ // ...
76
+ // ...
77
+ // ...
78
+ // ...
79
+ // ...
80
+ // ...
81
+ // ...
82
+ // ...
83
+ }
84
+ </script>
85
+ ` ,
86
+ } as SFCScriptBlock
87
+ const fileName = 'no-function-exceeds-limit.vue'
88
+ const maxSize = DEFAULT_OVERRIDE_CONFIG . maxFunctionSize
89
+ checkFunctionSize ( script , fileName , maxSize )
90
+ const result = reportFunctionSize ( maxSize )
91
+ expect ( result . length ) . toBe ( 0 )
92
+ expect ( result ) . toStrictEqual ( [ ] )
93
+ } )
94
+
56
95
it ( 'should not report files with multiple short functions' , ( ) => {
57
96
const script = {
58
97
content : `
0 commit comments