Unit testing Typescript decorators
<p>I have an application built on typescript with decorators for some convenience property assignments and wondering how I can go about writing unit tests for them. </p>

<pre><code> export function APIUrl() {
        return function (target: any, key: string) {
             let _value = target[key];

          function getter() {
            return _value;
          }

          function setter(newValue) {
            _value = getApiURL();
          }

          if (delete target[key]) {
            Object.defineProperty(target, key, {
                get: getter,
                set: setter
            });
          }
        };
    }
</code></pre>

<p>In a spec class I have,</p>

<pre><code> it("should return url string", ()=&gt; {
   @APIUrl();
   let baseURL:string;

   expect(baseURL typeOf string).toBe(true)
 })
</code></pre>