rofrischmann/elodin

View on GitHub
plugins/rename-variable/src/__tests__/index-test.js

Summary

Maintainability
A
0 mins
Test Coverage
import { traverse, parse } from '@elodin/core'

import renameVariable from '../index'

describe('Renaming variables', () => {
  it('should correctly rename variables', () => {
    const file = `style Button { paddingLeft: 10 paddingRight: $theme_colors_primary }`

    const ast = parse(file).ast

    expect(
      traverse(ast, [
        renameVariable({
          rename: (prop) => prop.split('_').join('.'),
        }),
      ])
    ).toMatchSnapshot()
  })
})