author kazuya kawaguchi (a.k.a. kazupon)
  import { RuleTester } from 'eslint' ; import rule = require ( '../../../lib/rules/no-dynamic-keys' ) ; const tester = new RuleTester ( { parser : require . resolve ( 'vue-eslint-parser' ) , parserOptions : { ecmaVersion : 2015 } } ) ; tester . run ( 'no-dynamic-keys' , rule as never , { valid : [ { code : `$t('hello')` } , { code : `t('messages.nested.hello')` } , { code : `$tc('messages.hello.link')` } , { code : `tc('hello-dio')` } , { code : `$t('hello {name}')` } , { code : `i18n.t('hello {name}')` } , { code : `<template>
      <p>{{ $t('hello') }}</p>
    </template>` } , { code : `<template>
      <p v-t="'hello'"></p>
    </template>` } , { code : `
      <template>
        <p>{{ $t(\`foo\`) }}</p>
        <i18n :path="\`foo\`"/>
        <p v-t="\`foo\`"></p>
      </template>
      <script>
      i18n.t(\`foo\`)
      </script>` } ] , invalid : [ { code : `$t(missing)` , errors : [ `'missing' dynamic key is used'` ] } , { code : `<template>
      <p>{{ $t(missing) }}</p>
    </template>` , errors : [ `'missing' dynamic key is used'` ] } , { code : `<template>
      <i18n :path="missing"/>
    </template>` , errors : [ `'missing' dynamic key is used'` ] } , { code : `<template>
      <i18n-t :path="missing"/>
    </template>` , errors : [ `'missing' dynamic key is used'` ] } , { code : `<template>
      <p v-t="missing"></p>
    </template>` , errors : [ `'missing' dynamic key is used'` ] } , { code : `
      <template>
        <p>{{ $t(foo.dynamic) }}</p>
        <i18n :path="foo.dynamic"/>
        <p v-t="foo.dynamic"></p>
      </template>
      <script>
      i18n.t(foo.dynamic)
      </script>` , errors : [ "'foo.dynamic' dynamic key is used'" , "'foo.dynamic' dynamic key is used'" , "'foo.dynamic' dynamic key is used'" , "'foo.dynamic' dynamic key is used'" ] } , { code : `
      <template>
        <p>{{ $t(foo()) }}</p>
        <i18n :path="foo()"/>
        <p v-t="foo()"></p>
      </template>
      <script>
      i18n.t(foo())
      </script>` , errors : [ "'foo()' dynamic key is used'" , "'foo()' dynamic key is used'" , "'foo()' dynamic key is used'" , "'foo()' dynamic key is used'" ] } ] } ) ;