summaryrefslogtreecommitdiff
path: root/test/fixers/test_tslint_fixer_callback.vader
blob: 5bfafe240fbf8c42f7579f5275d3b048caac9b78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Before:
  Save g:ale_typescript_tslint_executable
  Save g:ale_typescript_tslint_config_path

  let g:ale_typescript_tslint_executable = 'xxxinvalid'
  let g:ale_typescript_tslint_config_path = 'tslint.json'

  call ale#test#SetDirectory('/testplugin/test/fixers')
  silent cd ..
  silent cd command_callback
  let g:dir = getcwd()

After:
  Restore

  call ale#test#RestoreDirectory()

Execute(The tslint callback should return the correct default values):
  call ale#test#SetFilename('../prettier-test-files/testfile.ts')

  AssertEqual
  \ {
  \   'read_temporary_file': 1,
  \   'command': ale#Escape(g:ale_typescript_tslint_executable)
  \     . ' -c ' . ale#Escape('tslint.json')
  \     . ' --fix %t',
  \ },
  \ ale#fixers#tslint#Fix(bufnr(''))

Execute(The tslint callback should include custom tslint config option):
  let g:ale_typescript_tslint_config_path = '.tslintrc'
  call ale#test#SetFilename('../prettier-test-files/testfile.ts')

  AssertEqual
  \ {
  \   'read_temporary_file': 1,
  \   'command': ale#Escape(g:ale_typescript_tslint_executable)
  \     . ' -c ' . ale#Escape(g:ale_typescript_tslint_config_path)
  \     . ' --fix %t',
  \ },
  \ ale#fixers#tslint#Fix(bufnr(''))