-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from /issues/67
More consistent handling of apps, orgas and addons ids / names
- Loading branch information
Showing
10 changed files
with
258 additions
and
138 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var _ = require("lodash"); | ||
var Bacon = require("baconjs"); | ||
var expect = require('chai').expect; | ||
|
||
var Parsers = require('../src/parsers.js'); | ||
|
||
describe("parsers", function() { | ||
|
||
it("should parse dates", function() { | ||
expect(Parsers.date(1465842774000).success.getTime()).to.equal(new Date(1465842774000).getTime()); | ||
expect(Parsers.date("2016-01-01T00:00:00+02:00").success.getTime()).to.equal(new Date("2016-01-01T00:00:00+02:00").getTime()); | ||
expect(Parsers.date("yolo").success).to.equal(undefined); | ||
}); | ||
it("should parse appIds", function() { | ||
expect(Parsers.appIdOrName("app_65b3b15d-3a35-4369-ab8f-28b0293e7b69").success).to.deep.equal({ app_id: "app_65b3b15d-3a35-4369-ab8f-28b0293e7b69" }); | ||
}); | ||
it("should parse app names", function() { | ||
expect(Parsers.appIdOrName("My great app").success).to.deep.equal({ app_name: "My great app" }); | ||
}); | ||
it("should parse orgaIds", function() { | ||
expect(Parsers.orgaIdOrName("orga_65b3b15d-3a35-4369-ab8f-28b0293e7b69").success).to.deep.equal({ orga_id: "orga_65b3b15d-3a35-4369-ab8f-28b0293e7b69" }); | ||
}); | ||
it("should parse orga names", function() { | ||
expect(Parsers.orgaIdOrName("My great organisation").success).to.deep.equal({ orga_name: "My great organisation" }); | ||
}); | ||
it("should parse addonIds", function() { | ||
expect(Parsers.addonIdOrName("addon_65b3b15d-3a35-4369-ab8f-28b0293e7b69").success).to.deep.equal({ addon_id: "addon_65b3b15d-3a35-4369-ab8f-28b0293e7b69" }); | ||
}); | ||
it("should parse addon names", function() { | ||
expect(Parsers.addonIdOrName("My great addon").success).to.deep.equal({ addon_name: "My great addon" }); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.