Skip to content

Commit

Permalink
v3.32.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Nov 5, 2023
1 parent f796f60 commit 0375b65
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 144 deletions.
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.33.0 2023-11-05

* Remove norma library, replace functionality with update gubu library.


## 3.32.1 2023-09-16

* Provide Seneca 4 act-err argument variants via `act-err-4` temporary event.
Expand Down
1 change: 1 addition & 0 deletions lib/ready.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ready.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@hapi/lab": "25",
"@seneca/test-plugin": "0.1.0",
"@types/node": "^20.8.10",
"async": "^3.2.4",
"async": "^3.2.5",
"bench": "^0.3.6",
"coveralls": "^3.1.1",
"gex": "^4.0.1",
Expand Down
128 changes: 80 additions & 48 deletions test/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,59 @@ describe('add', function () {
it('args', function (fin) {
const si = Seneca().test()
si
// First can be jsonic
.add({a:1}, function a1(msg,reply){reply({x:1})})
.add('a:2', function a2(msg,reply){reply({x:2})})
// First can be jsonic
.add({ a: 1 }, function a1(msg, reply) {
reply({ x: 1 })
})
.add('a:2', function a2(msg, reply) {
reply({ x: 2 })
})

// Second is always an object.
.add({a:3}, {b:1}, function a3b1(msg,reply){reply({x:3})})
.add('a:4', {b:2}, function a4b2(msg,reply){reply({x:4})})
// Second is always an object.
.add({ a: 3 }, { b: 1 }, function a3b1(msg, reply) {
reply({ x: 3 })
})
.add('a:4', { b: 2 }, function a4b2(msg, reply) {
reply({ x: 4 })
})

// Sub patterns don't need an action.
.add({a:5})
// Sub patterns don't need an action.
.add({ a: 5 })
.add('a:6')
.add({a:7})
.add('a:8', {b:5})

.add({a:9},
function a9(msg,reply){reply({x:9})},{plugin_name:'p9'})
.add('a:10',
function a10(msg,reply){reply({x:10})},{plugin_name:'p10'})
.add({a:11}, {b:6},
function a11b6(msg,reply){reply({x:11})},{plugin_name:'p11'})
.add('a:12', {b:7},
function a12b7(msg,reply){reply({x:12})},{plugin_name:'p12'})

.add({ a: 7 })
.add('a:8', { b: 5 })

.add(
{ a: 9 },
function a9(msg, reply) {
reply({ x: 9 })
},
{ plugin_name: 'p9' },
)
.add(
'a:10',
function a10(msg, reply) {
reply({ x: 10 })
},
{ plugin_name: 'p10' },
)
.add(
{ a: 11 },
{ b: 6 },
function a11b6(msg, reply) {
reply({ x: 11 })
},
{ plugin_name: 'p11' },
)
.add(
'a:12',
{ b: 7 },
function a12b7(msg, reply) {
reply({ x: 12 })
},
{ plugin_name: 'p12' },
)

let pats = si.list('a:*')
// console.log(pats)
expect(pats).equal([
Expand All @@ -54,43 +84,43 @@ describe('add', function () {
{ a: '9' },
{ a: '10' },
{ a: '11', b: '6' },
{ a: '12', b: '7' }
{ a: '12', b: '7' },
])
si.act('a:1', function(err, out) {

si.act('a:1', function (err, out) {
expect(err).equal(null)
expect(out).equal({x:1})
expect(out).equal({ x: 1 })

si.act('a:2', function(err, out) {
si.act('a:2', function (err, out) {
expect(err).equal(null)
expect(out).equal({x:2})
expect(out).equal({ x: 2 })

si.act('a:3,b:1', function(err, out) {
si.act('a:3,b:1', function (err, out) {
expect(err).equal(null)
expect(out).equal({x:3})
expect(out).equal({ x: 3 })

si.act('a:4,b:2', function(err, out) {
si.act('a:4,b:2', function (err, out) {
expect(err).equal(null)
expect(out).equal({x:4})
expect(out).equal({ x: 4 })

si.act('a:9', function(err, out, meta) {
si.act('a:9', function (err, out, meta) {
expect(err).equal(null)
expect(out).equal({x:9})
expect(out).equal({ x: 9 })
expect(meta.plugin.name).equal('p9')

si.act('a:10', function(err, out, meta) {
si.act('a:10', function (err, out, meta) {
expect(err).equal(null)
expect(out).equal({x:10})
expect(out).equal({ x: 10 })
expect(meta.plugin.name).equal('p10')

si.act('a:11,b:6', function(err, out, meta) {
si.act('a:11,b:6', function (err, out, meta) {
expect(err).equal(null)
expect(out).equal({x:11})
expect(out).equal({ x: 11 })
expect(meta.plugin.name).equal('p11')

si.act('a:12,b:7', function(err, out, meta) {
si.act('a:12,b:7', function (err, out, meta) {
expect(err).equal(null)
expect(out).equal({x:12})
expect(out).equal({ x: 12 })
expect(meta.plugin.name).equal('p12')

fin()
Expand All @@ -107,14 +137,14 @@ describe('add', function () {
it('args-error', function (fin) {
const si = Seneca().test()

expect(()=>si.add('a','b'))
.throw('seneca (add): Validation failed for property "actdef"'+
' with string "b" because the string is not of type object.')
expect(() => si.add('a', 'b')).throw(
'seneca (add): Validation failed for property "actdef"' +
' with string "b" because the string is not of type object.',
)

fin()
})



it('action-name', function (fin) {
var si = Seneca().test()

Expand Down Expand Up @@ -193,9 +223,10 @@ describe('add', function () {
expect(e).exist()
expect(o).not.exist()
expect(e.code).equal('act_invalid_msg')
expect(e.details.props)
.equal([{ path: 'b', what: 'type', type: 'number', value: 'x' }])

expect(e.details.props).equal([
{ path: 'b', what: 'type', type: 'number', value: 'x' },
])

si.act({ a: 2, b: 3 }, function (e, o) {
expect(e).not.exist()
expect(o).equal({ b: 9 })
Expand All @@ -204,8 +235,9 @@ describe('add', function () {
expect(e).exist()
expect(o).not.exist()
expect(e.code).equal('act_invalid_msg')
expect(e.details.props)
.equal([{ path: 'b', what: 'type', type: 'number', value: 'x' }])
expect(e.details.props).equal([
{ path: 'b', what: 'type', type: 'number', value: 'x' },
])

fin()
})
Expand Down
4 changes: 2 additions & 2 deletions test/common.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ var it = Shared.make_it(lab)
describe('common', function () {
it('stringify', function (fin) {
expect(Common.stringify({})).equal('{}')
expect(Common.stringify({a:1})).equal('{"a":1}')
expect(Common.stringify({ a: 1 })).equal('{"a":1}')
fin()
})

it('misc', function (fin) {
expect(Common.boolify(true)).to.equal(true)
expect(Common.boolify(false)).to.equal(false)
Expand Down
2 changes: 1 addition & 1 deletion test/delegation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('delegation', function () {
})
var sid = si.delegate({ a$: 'A', b: 'B' })
// console.log('SID', sid)

assert.ok(Gex('Seneca/*.*.*/*').on(si.toString()))
assert.ok(Gex('Seneca/*.*.*/*/{b:B}').on(sid.toString()))

Expand Down
16 changes: 8 additions & 8 deletions test/inward.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ describe('inward', function () {
try {
API.inward()
expect(false).true()
}
catch (e) {
expect(e.message)
.equal('seneca: Validation failed for property "inward"'+
' with value "undefined" because the value is required.')
expect({...e}).includes({
} catch (e) {
expect(e.message).equal(
'seneca: Validation failed for property "inward"' +
' with value "undefined" because the value is required.',
)
expect({ ...e }).includes({
gubu: true,
code: 'shape',
})
expect(e.props[0]).includes({
path:'inward',
type:'function'
path: 'inward',
type: 'function',
})
}

Expand Down
7 changes: 2 additions & 5 deletions test/legacy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ describe('legacy', function () {
})
})


it('act_if', function (done) {
var si = Seneca({ log: 'silent' })

Expand All @@ -158,12 +157,11 @@ describe('legacy', function () {
expect(true).equal(false)
})
expect(true).equal(false)
}
catch (e) {
} catch (e) {
expect(e.message).match(/not of type boolean/)
}

si = Seneca({log:'test'})
si = Seneca({ log: 'test' })
.add('a:1', function (msg, reply) {
reply({ b: msg.a + 1 })
})
Expand All @@ -182,5 +180,4 @@ describe('legacy', function () {
process.nextTick(done)
})
})

})
16 changes: 8 additions & 8 deletions test/outward.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ describe('outward', function () {
try {
API.outward()
expect(false).true()
}
catch (e) {
expect(e.message)
.equal('seneca: Validation failed for property "outward"'+
' with value "undefined" because the value is required.')
expect({...e}).includes({
} catch (e) {
expect(e.message).equal(
'seneca: Validation failed for property "outward"' +
' with value "undefined" because the value is required.',
)
expect({ ...e }).includes({
gubu: true,
code: 'shape',
})
expect(e.props[0]).includes({
path:'outward',
type:'function'
path: 'outward',
type: 'function',
})
}

Expand Down
2 changes: 1 addition & 1 deletion test/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ describe('plugin', function () {
fin()
})
.use(function foo() {
this.add('a','b')
this.add('a', 'b')
})
})

Expand Down
4 changes: 2 additions & 2 deletions test/quick.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let s0 = Seneca({
// action: false,
// },
// },
system:{action:{add:false}},
system: { action: { add: false } },
})
.test()
// .use('entity')
Expand All @@ -31,7 +31,7 @@ let s0 = Seneca({
// console.log('FOO_INTERCEPTOR', actcall)
// }
// }, Seneca.util.print)
.add({a:1}, function a1(msg, reply) {
.add({ a: 1 }, function a1(msg, reply) {
reply({ x: msg.x })
})
// .add('b:1', function a1(msg, reply) {
Expand Down
Loading

0 comments on commit 0375b65

Please sign in to comment.