docusaurus/packages/stylelint-copyright/tests/index.js
Yangshun Tay 6cc0aa2e75
fix(v2): improve stylelint copyright header rule (#2363)
* fix(v2): improve stylelint copyright header rule

* Whitelist stylelint-copyright from Jest
2020-03-07 11:49:52 +08:00

58 lines
913 B
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const testRule = require('stylelint-test-rule-tape');
const stylelintCopyright = require('..');
testRule(stylelintCopyright.rule, {
ruleName: stylelintCopyright.ruleName,
accept: [
{
code: `
/**
* Copyright
*/
.foo {}`,
},
{
code: `
/**
* copyright
*/
.foo {}`,
},
],
reject: [
{
code: `
/**
* Copyleft
*/
.foo {}`,
message: `Missing copyright in the header comment (${stylelintCopyright.ruleName})`,
line: 2,
column: 1,
},
{
code: `
/**
* Copyleft
*/
/**
* Copyright
*/
.foo {}`,
message: `Missing copyright in the header comment (${stylelintCopyright.ruleName})`,
line: 2,
column: 1,
},
],
});