Permalink
Browse files

patrun 0.5.1; fixes issue #375

  • Loading branch information...
1 parent b6fcae0 commit 455b208ca025b8e87961ee860de4019e12633e7c @rjrodger rjrodger committed Sep 13, 2016
Showing with 63 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +1 −1 package.json
  3. +61 −0 test/seneca.test.js
View
@@ -13,5 +13,6 @@ out
tmp
test/db
node_modules
+node_modules-*
docs/annotated
docs/coverage.html
View
@@ -85,7 +85,7 @@
"minimist": "1.2.0",
"nid": "0.3.2",
"norma": "0.3.0",
- "patrun": "0.5.0",
+ "patrun": "0.5.1",
"rolling-stats": "0.1.1",
"semver": "5.3.0",
"seneca-transport": "2.1.0",
View
@@ -1299,4 +1299,65 @@ describe('seneca', function () {
done()
})
})
+
+
+ // Confirms fix for https://github.com/senecajs/seneca/issues/375
+ it('catchall-pattern', function (done) {
+ var seneca = Seneca({ log: 'test' }).error(done)
+
+ seneca
+ .add('', function (msg, done) { done(null, {r: 1}) })
+ .add('a:1', function (msg, done) { done(null, {x: 1}) })
+ .add('b:1,c:1', function (msg, done) { done(null, {z: 1}) })
+
+ // Execute following actions sequentially, so that
+ // .ready(done) will wait for them to complete
+ .gate()
+
+ .act('k:1', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ .act('a:1', function (ignored, out) {
+ expect(out.x).to.equal(1)
+ })
+
+ .act('a:2', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ // Hits the catchall, even though b:1 is a partial pattern
+ .act('b:1', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ .act('b:2', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ .act('c:1', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ .act('c:2', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ .act('b:1,c:1', function (ignored, out) {
+ expect(out.z).to.equal(1)
+ })
+
+ .act('b:2,c:1', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ // Hits the catchall, even though b:1 is a partial pattern
+ .act('b:1,c:2', function (ignored, out) {
+ expect(out.r).to.equal(1)
+ })
+
+ .ungate()
+
+ .ready(done)
+ })
})

0 comments on commit 455b208

Please sign in to comment.