decipherinc / angular-debaser Goto Github PK
View Code? Open in Web Editor NEWJust a better way to test AngularJS apps.
Home Page: http://decipherinc.github.io/angular-debaser
License: MIT License
Just a better way to test AngularJS apps.
Home Page: http://decipherinc.github.io/angular-debaser
License: MIT License
Use with npm/browserify? I noticed that private
is set to true
in the package.json
file. Would you publish this to npm and support CommonJS?
it's shorter and pretty obvious.
pretty sure I built in support for this sort of thing. the Sinon functions are all aliased to func
so should not be a rabbit hole.
this should be pretty easy
obviously some sort of misconfiguration, but I'm going to have to track down where exactly it came from. this may have been an errant grunt gh-pages
against an old branch.
how to mock functions that return promise?
I've discovered an issue in my code where the first object to be declared in a debaser chain is not stubbed:
beforeEach(function () {
debaser()
.module('lander')
.object('$location', {first: "first"})
.object('$window', { lander_gon: { searchKeywords: "Test Keyword", searchLocation: "Test City" }, location: { replace: sinon.stub() } })
.debase();
});
logging these objects from the application code shows that $location is the actual implementation:
Tb {$$protocol: "http", $$host: "server", $$port: 80, $$parse: function, $$compose: function…}
However, if I add any other declaration before it:
beforeEach(function () {
debaser()
.module('lander')
.object('$location', {first: "first"})
.object('$location', {second: "second"})
.object('$window', { lander_gon: { searchKeywords: "Test Keyword", searchLocation: "Test City" }, location: { replace: sinon.stub() } })
.debase();
});
I get:
Object {second: "second"}
This is not limited to the location object (I first noticed it with $window).
This is occurring with Jasmine 2.0.2, angular-debaser 0.3.2
I'm kicking myself for not filling out the description before, but I believe what's happening is if you stub an existing module, and provide a constant with the name of an existing constant, you get the real one.
We need a lot of docstrings to get the API documentation (jsdoc) usable.
I don't really dig on the constant api:
// module with constant object bar
module('foo').withObject('bar', {baz: 'quux'})
We don't need explicit modules. anonymous modules are fine. we should just be able to provide:
constantObject()
convenience methodconstantFunc()
convenience methodconstant()
method which has more poweroptions
parameter to func
and object
in which you can define either of these as constantsCurrent version of PhantomJS (1.9.7) doesn't support Function.prototype.bind yet:
ariya/phantomjs#10522
so debaser fails with:
TypeError: 'undefined' is not a function (evaluating 'function run() {
this.next.apply(this, arguments);
}.bind(this)')
at runner (.../lib/angular-debaser/debaser.js:604)
Getting a 404 error over there.
I wonder if there's a way to run the tests using Jasmine and Mocha+Chai easily. The syntax is slightly different, of course, and I'm not sure how well the Sinon assertions will hold up.
autoScope
option needs tests
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.