@@ -20,6 +20,7 @@ import {
2020 emitLocation,
2121 emitSelection,
2222 emitOriginTracing,
23+ SelectionEmitters,
2324} from '../../../src/code-export/emit'
2425import TestCase from '../../../../selenium-ide/src/neo/models/TestCase'
2526import Command from '../../../../selenium-ide/src/neo/models/Command'
@@ -76,15 +77,15 @@ describe('Command emitter', () => {
7677describe('Location emitter', () => {
7778 it('emits by sync emitter', () => {
7879 const emitters = {
79- id : selector => {
80+ id: ( selector) => {
8081 return `By.id("${selector}")`
8182 },
8283 }
8384 expect(emitLocation('id=blah', emitters)).toEqual(`By.id("blah")`)
8485 })
8586 it('emits by async emitter', () => {
8687 const emitters = {
87- id : selector => {
88+ id: ( selector) => {
8889 return Promise.resolve(`By.id("${selector}")`)
8990 },
9091 }
@@ -103,20 +104,20 @@ describe('Location emitter', () => {
103104describe('Selection emitter', () => {
104105 it('emits by sync emitter', () => {
105106 const emitters = {
106- id : id => {
107+ id: (id) => {
107108 return `By.css(\`*[id="${id}"]\`)`
108109 },
109- }
110+ } as unknown as SelectionEmitters
110111 expect(emitSelection('id=blah', emitters)).toEqual(
111112 `By.css(\`*[id="blah"]\`)`
112113 )
113114 })
114115 it('emits by async emitter', () => {
115116 const emitters = {
116- id : id => {
117+ id: (id) => {
117118 return Promise.resolve(`By.css(\`*[id="${id}"]\`)`)
118119 },
119- }
120+ } as unknown as SelectionEmitters
120121 expect(emitSelection('id=blah', emitters)).resolves.toBe(
121122 `By.css(\`*[id="blah"]\`)`
122123 )
@@ -138,25 +139,27 @@ describe('Trace emitter', () => {
138139 const test = new TestCase()
139140 test.createCommand(undefined, 'a', 'foo', 'bar')
140141 test.createCommand(undefined, 'b', 'baz', 'qux', 'a comment')
141- expect ( emitOriginTracing ( test , { commentPrefix : '//' } , true , false ) ) . toEqual ( [
142+ expect(
143+ emitOriginTracing(test, { commentPrefix: '//' }, true, false)
144+ ).toEqual([
142145 '// Test name: Untitled Test',
143146 '// Step # | name | target | value | comment',
144147 '// 1 | a | foo | bar | ',
145148 '// 2 | b | baz | qux | a comment',
146149 ])
147- expect ( emitOriginTracing ( test , { commentPrefix : '//' } , true , true ) ) . toEqual ( [
150+ expect(
151+ emitOriginTracing(test, { commentPrefix: '//' }, true, true)
152+ ).toEqual([
148153 '// Test name: Untitled Test',
149154 '// Step # | name | target | value',
150155 '// 1 | a | foo | bar',
151156 '// 2 | b | baz | qux\n// a comment',
152157 ])
153- expect ( emitOriginTracing ( test , { commentPrefix : '//' } , false , true ) ) . toEqual ( [
154- '' ,
155- '// a comment' ,
156- ] )
157- expect ( emitOriginTracing ( test , { commentPrefix : '//' } , false , false ) ) . toEqual ( [
158- '' ,
159- '' ,
160- ] )
158+ expect(
159+ emitOriginTracing(test, { commentPrefix: '//' }, false, true)
160+ ).toEqual(['', '// a comment'])
161+ expect(
162+ emitOriginTracing(test, { commentPrefix: '//' }, false, false)
163+ ).toEqual(['', ''])
161164 })
162165})
0 commit comments