const builder = require('./builder');
^^^^^
SyntaxError: Use of const in strict mode.
I'm probably on the wrong node version. "nvm" is what controls that, and hopefully by using "nvm alias default X.X.X" I shouldn't see this again.
(bonus... looking into how to test validators that reject or resolve the defereds from a $q defer()
promise = creativeCreateService.validators.impressionTracker3('http://foobar.com');
expect(this.unwrapPromise(promise)).toBeTruthy();
promise = creativeCreateService.validators.impressionTracker3('https://foobar.com');
expect(this.unwrapPromise(promise)).toBeTruthy();
promise = creativeCreateService.validators.impressionTracker3(_.repeat('A',20));
expect(this.unwrapPromiseRejection(promise)).toBe('Impression tracker must start with http:// or https:// if provided');
expect(this.unwrapPromise(promise)).toBeTruthy();
promise = creativeCreateService.validators.impressionTracker3('https://foobar.com');
expect(this.unwrapPromise(promise)).toBeTruthy();
promise = creativeCreateService.validators.impressionTracker3(_.repeat('A',20));
expect(this.unwrapPromiseRejection(promise)).toBe('Impression tracker must start with http:// or https:// if provided');
the code that supports it is:
self.unwrapPromise = function unwrapPromise(promise) {
var value;
promise.then(function (result) {
value = result;
});
self.$digest();
return value;
};
self.unwrapPromiseRejection = function unwrapPromiseRejection(promise) {
var value;
promise.catch(function (error) {
value = error;
});
self.$digest();
return value;
};