Last active
December 15, 2015 18:29
-
-
Save camshaft/5304252 to your computer and use it in GitHub Desktop.
hyperbridge design
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("client", function(){ | |
it("should get the root resource", function(done) { | |
client() | |
.end(function(err, root) { | |
if(err) return done(err); | |
should.exist(root.links); | |
done(); | |
}); | |
}); | |
it("should follow a link", function(done) { | |
client() | |
.end(function(err, root) { | |
if(err) return done(err); | |
root | |
.follow("profile") | |
.end(function(err, profile) { | |
if(err) return done(err); | |
should.exist(profile.body); | |
done(); | |
}); | |
}); | |
}); | |
it("should submit a form", function(done){ | |
client() | |
.end(function(err, root) { | |
if(err) return done(err); | |
root | |
.follow("profile") | |
.end(function(err, profile) { | |
if(err) return done(err); | |
profile | |
.submit("update") | |
.set({name: "Cameron"}) | |
.end(function(err, profile) { | |
if(err) return done(err); | |
profile.body.name.should.eql("Cameron"); | |
done(); | |
}); | |
}); | |
}); | |
}); | |
it("should get the root with an access token", function(done){ | |
var accessToken = "testing123"; | |
client(accessToken) | |
.end(function(err, root) { | |
if(err) return done(err); | |
should.exist(root.links); | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment