strongloop / gulp-loopback-sdk-angular

gulp plugin for auto-generating Angular $resource services for LoopBack
MIT License
27 stars 15 forks source link

CI: Change test to not match file.length due to high maintenance #12

Closed davidcheung closed 8 years ago

davidcheung commented 8 years ago

Reason

Right now the test checks for file size matching, which means everytime master of angular changes, we need to manually update the fixtures/lb-services.js, Right now if not master/jenkins/npm-released are the same version, likely one will fail.

Goal

Goal is to change test to not match file.length due to high maintenance.

Alternatives

cc/ @bajtos

bajtos commented 8 years ago

@davidcheung take a look at tests in loopback-angular-sdk-cli and grunt-loopback-angular-sdk. We need a simple smoke test to verify that the gulp plugin called the SDK codegen correctly, for example by checking few regular expressions (does the code contain the module name lbServices, etc.). There is no need to check file size.

davidcheung commented 8 years ago

@bajtos agreed. the current test does a size.length as well as checking for the module in the generated file.

assert(/var urlBase = "\/rest-api-root";/.test(file.contents));
    assert(/var module = angular.module\("lbServices", \['ngResource'\]\);/
      .test(file.contents));