mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
feat: update tests
feat: update tests feat: update tests
This commit is contained in:
58
configuration/eslint-config/copyright-header-rule.spec.js
Normal file
58
configuration/eslint-config/copyright-header-rule.spec.js
Normal 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"'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
Reference in New Issue
Block a user