feat: update tests

feat: update tests

feat: update tests
This commit is contained in:
2023-05-30 16:12:00 +02:00
parent d6d4f6e5c4
commit 0d60b8bfad
87 changed files with 1021 additions and 823 deletions

View File

@@ -0,0 +1,58 @@
// @ts-check
"use strict"
const rule = require('./copyright-header-rule')
const RuleTester = require('eslint').RuleTester
const ruleTester = new RuleTester()
const options = [{
fixedDate: '2023',
author: 'Me',
license: `*\n * Copyright {{year}} {{author}}\n *\n * contents\n `,
}]
ruleTester.run('copyright-header', rule, {
valid: [
{
code: `/**\n * Copyright 2023 Me\n *\n * contents\n */`,
options,
},
{
code: `// @ts-check\n\n\n/**\n * Copyright 2023 Me\n *\n * contents\n */`,
options,
}
],
invalid: [
{
code: `// bla\n/**\n * Copyright 2022 Me\n *\n * contents\n */\n\nvar s = "abc"`,
options,
errors: [
{
messageId: 'invalid',
suggestions: [
{
messageId: 'tryThisHeader',
output: '// bla\n/**\n * Copyright 2023 Me\n *\n * contents\n */\n\nvar s = "abc"'
}
]
}
],
},
{
code: 'var s = "abc"',
options,
errors: [
{
messageId: 'missing',
suggestions: [
{
messageId: 'tryThisHeader',
output: '/**\n * Copyright 2023 Me\n *\n * contents\n */\nvar s = "abc"'
}
]
}
]
}
]
})