<commit_before>import {
  ruleTester,
  warningFreeBasics,
} from "../../../testUtils"
import rule, { ruleName, messages } from ".."

const testRule = ruleTester(rule, ruleName)

testRule("numeric", tr => {
  warningFreeBasics(tr)

  tr.ok("a { font-weight: 100; }")
  tr.ok("a { font-weight: 700; }")
  tr.ok("a { font-weight: 850; }")
  tr.ok("a { font-weight: 900; }")
  tr.ok("a { font: italic small-caps 400 16px/3 cursive; }")
  tr.ok("a { font: italic small-caps 400 16px/500 cursive; }")

  tr.notOk("a { font-weight: normal; }", {
    message: messages.expected("numeric"),
    line: 1,
    column: 18,
  })
  tr.notOk("a { font: italic small-caps bolder 16px/3 cursive; }", {
    message: messages.expected("numeric"),
    line: 1,
    column: 29,
  })
})

testRule("named", tr => {
  warningFreeBasics(tr)

  tr.ok("a { font-weight: bold; }")
  tr.ok("a { font-weight: bolder; }")
  tr.ok("a { font-weight: normal; }")
  tr.ok("a { font-weight: lighter; }")
  tr.ok("a { font: italic small-caps bold 16px/500 cursive; }")

  tr.notOk("a { font-weight: 400; }", {
    message: messages.expected("named"),
    line: 1,
    column: 18,
  })
  tr.notOk("a { font: italic small-caps 700 16px/3 cursive; }", {
    message: messages.expected("named"),
    line: 1,
    column: 29,
  })
})<commit_msg>Add numeric/named within font name tests<commit_after>import {
  ruleTester,
  warningFreeBasics,
} from "../../../testUtils"
import rule, { ruleName, messages } from ".."

const testRule = ruleTester(rule, ruleName)

testRule("numeric", tr => {
  warningFreeBasics(tr)

  tr.ok("a { font-weight: 100; }")
  tr.ok("a { font-weight: 700; }")
  tr.ok("a { font-weight: 850; }")
  tr.ok("a { font-weight: 900; }")
  tr.ok("a { font: italic small-caps 400 16px/3 cursive; }")
  tr.ok("a { font: italic small-caps 400 16px/500 cursive; }")
  tr.ok("a { font: italic small-caps 400 16px/500 \"bold font name\"; }")
  tr.ok("a { font: italic small-caps 400 16px/500 boldfontname; }")

  tr.notOk("a { font-weight: normal; }", {
    message: messages.expected("numeric"),
    line: 1,
    column: 18,
  })
  tr.notOk("a { font: italic small-caps bolder 16px/3 cursive; }", {
    message: messages.expected("numeric"),
    line: 1,
    column: 29,
  })
})

testRule("named", tr => {
  warningFreeBasics(tr)

  tr.ok("a { font-weight: bold; }")
  tr.ok("a { font-weight: bolder; }")
  tr.ok("a { font-weight: normal; }")
  tr.ok("a { font-weight: lighter; }")
  tr.ok("a { font: italic small-caps bold 16px/500 cursive; }")
  tr.ok("a { font: italic small-caps bold 16px/500 \"cursive 100 font\"; }")
  tr.ok("a { font: italic small-caps bold 16px/500 100cursivefont; }")

  tr.notOk("a { font-weight: 400; }", {
    message: messages.expected("named"),
    line: 1,
    column: 18,
  })
  tr.notOk("a { font: italic small-caps 700 16px/3 cursive; }", {
    message: messages.expected("named"),
    line: 1,
    column: 29,
  })
})
{'fraction_non_alphanumeric': 0.19794871794871796, 'fraction_numerical': 0.048547008547008545, 'mean_word_length': 3.246734397677794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5444726', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1111, 'n_words': 255}