2011-10-26 02:22:29 +00:00
|
|
|
describe 'HeadlessReporterResult', ->
|
|
|
|
result = null
|
|
|
|
name = "name"
|
|
|
|
splitName = "splitName"
|
|
|
|
message = 'message'
|
|
|
|
|
2011-12-12 17:22:32 +00:00
|
|
|
context 'no lines', ->
|
|
|
|
beforeEach ->
|
|
|
|
result = new HeadlessReporterResult(name, splitName)
|
2011-10-26 02:22:29 +00:00
|
|
|
|
2011-12-12 17:22:32 +00:00
|
|
|
describe '#addResult', ->
|
|
|
|
it 'should add a message', ->
|
|
|
|
result.addResult(message)
|
|
|
|
|
|
|
|
expect(result.results).toEqual([ message ])
|
|
|
|
|
|
|
|
context 'with lines', ->
|
|
|
|
beforeEach ->
|
|
|
|
HeadlessReporterResult.specLineNumbers = {
|
|
|
|
'one': {
|
|
|
|
'name': [ 1 ],
|
|
|
|
'of': [ 2, 9 ],
|
|
|
|
'test': [ 3, 10 ],
|
|
|
|
'other': [ 7 ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
it 'should find the best spec lines', ->
|
|
|
|
expect(HeadlessReporterResult.findSpecLine([ 'name', 'of', 'test' ]).lineNumber).toEqual(3)
|
|
|
|
expect(HeadlessReporterResult.findSpecLine([ 'other', 'of', 'test' ]).lineNumber).toEqual(10)
|
2011-10-26 02:22:29 +00:00
|
|
|
|