chai-latte
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -19,3 +19,6 @@ import { ConfigurableCallback } from './lib/ConfigurableCallback'; | ||
isLastPointerCallback(): boolean; | ||
handleFunctionCalled(arg: unknown): void; | ||
debugId: string; | ||
updateDebugProp(prop: any): void; | ||
updateDebugFunction(arg: any): void; | ||
handleFunctionCalled(arg: any): void; | ||
handlePropertyAccess(prop: string): void; | ||
@@ -22,0 +25,0 @@ createBuilderProxy(): any; |
@@ -43,2 +43,13 @@ "use strict"; | ||
} | ||
debugId = ''; | ||
updateDebugProp(prop) { | ||
this.debugId += this.debugId ? '.' + prop : prop; | ||
} | ||
updateDebugFunction(arg) { | ||
if (typeof arg === 'undefined') { | ||
this.debugId += '()'; | ||
return; | ||
} | ||
this.debugId += '(' + arg.name + ')'; | ||
} | ||
handleFunctionCalled(arg) { | ||
@@ -48,2 +59,3 @@ const fluentFunction = this.createConfigurableCallback(); | ||
fluentFunction.updateArg(arg); | ||
this.updateDebugFunction(arg); | ||
} | ||
@@ -59,2 +71,3 @@ handlePropertyAccess(prop) { | ||
} | ||
this.updateDebugProp(prop); | ||
this.pointer.accessProp(prop); | ||
@@ -61,0 +74,0 @@ this.pointer.movePointer(prop); |
{ | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"name": "chai-latte", | ||
@@ -4,0 +4,0 @@ "description": "Toolkit to build expressive & readable fluent interface libraries.", |
@@ -54,6 +54,21 @@ import { ConfigurableCallback } from './lib/ConfigurableCallback'; | ||
handleFunctionCalled(arg: unknown) { | ||
debugId = ''; | ||
updateDebugProp(prop) { | ||
this.debugId += this.debugId ? '.' + prop : prop; | ||
} | ||
updateDebugFunction(arg) { | ||
if (typeof arg === 'undefined') { | ||
this.debugId += '()'; | ||
return; | ||
} | ||
this.debugId += '(' + arg.name + ')'; | ||
} | ||
handleFunctionCalled(arg: any) { | ||
const fluentFunction = this.createConfigurableCallback(); | ||
this.pointer.overrideLastPointer(fluentFunction.callback) | ||
fluentFunction.updateArg(arg); | ||
this.updateDebugFunction(arg); | ||
} | ||
@@ -71,2 +86,3 @@ | ||
this.updateDebugProp(prop); | ||
this.pointer.accessProp(prop); | ||
@@ -73,0 +89,0 @@ this.pointer.movePointer(prop); |
import { Builder } from '..'; | ||
import { expression } from '../../'; | ||
import { combineTest } from './lib/combineTest'; | ||
@@ -212,2 +213,9 @@ | ||
describe('Debug', () => { | ||
it('should create a debugId for each expression', () => { | ||
const exp = expression(({ the }) => the(String).name.do(String).it(String), () => {}); | ||
expect(exp.builder.debugId).toEqual('the(String).name.do(String).it(String)'); | ||
}) | ||
}) | ||
describe('Combined Builders', () => { | ||
@@ -214,0 +222,0 @@ function buildFluentAPIMock(buildCallback, forceCallback?) { |
Sorry, the diff of this file is not supported yet
204660
2605
84