-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1243-vatPowers-testLog'
Remove use of `helpers.log` from all tests, replacing them with `vatPowers.testLog`. This moves everything outside of swingset's internal tests to using `buildRootObject` instead of `setup`, reducing the supported API surface so we can do more cleanup work. refs #1243
- Loading branch information
Showing
73 changed files
with
561 additions
and
1,074 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
/* global harden */ | ||
|
||
export default function setup(syscall, state, helpers) { | ||
function log(what) { | ||
helpers.log(what); | ||
console.log(what); | ||
} | ||
|
||
return helpers.makeLiveSlots( | ||
syscall, | ||
state, | ||
_vatPowers => | ||
harden({ | ||
encourageMe(name) { | ||
log(`=> encouragementBot.encourageMe got the name: ${name}`); | ||
return `${name}, you are awesome, keep it up!`; | ||
}, | ||
}), | ||
helpers.vatID, | ||
); | ||
export function buildRootObject(vatPowers) { | ||
return harden({ | ||
encourageMe(name) { | ||
vatPowers.testLog( | ||
`=> encouragementBot.encourageMe got the name: ${name}`, | ||
); | ||
return `${name}, you are awesome, keep it up!`; | ||
}, | ||
}); | ||
} |
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 |
---|---|---|
@@ -1,26 +1,17 @@ | ||
/* global harden */ | ||
import { E } from '@agoric/eventual-send'; | ||
|
||
export default function setup(syscall, state, helpers) { | ||
function log(what) { | ||
helpers.log(what); | ||
console.log(what); | ||
} | ||
return helpers.makeLiveSlots( | ||
syscall, | ||
state, | ||
_vatPowers => | ||
harden({ | ||
talkToBot(bot, botName) { | ||
log(`=> user.talkToBot is called with ${botName}`); | ||
E(bot) | ||
.encourageMe('user') | ||
.then(myEncouragement => | ||
log(`=> user receives the encouragement: ${myEncouragement}`), | ||
); | ||
return 'Thanks for the setup. I sure hope I get some encouragement...'; | ||
}, | ||
}), | ||
helpers.vatID, | ||
); | ||
export function buildRootObject(vatPowers) { | ||
const log = vatPowers.testLog; | ||
return harden({ | ||
talkToBot(bot, botName) { | ||
log(`=> user.talkToBot is called with ${botName}`); | ||
E(bot) | ||
.encourageMe('user') | ||
.then(myEncouragement => | ||
log(`=> user receives the encouragement: ${myEncouragement}`), | ||
); | ||
return 'Thanks for the setup. I sure hope I get some encouragement...'; | ||
}, | ||
}); | ||
} |
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 |
---|---|---|
@@ -1,21 +1,12 @@ | ||
/* global harden */ | ||
|
||
export default function setup(syscall, state, helpers) { | ||
function log(what) { | ||
helpers.log(what); | ||
console.log(what); | ||
} | ||
|
||
return helpers.makeLiveSlots( | ||
syscall, | ||
state, | ||
_vatPowers => | ||
harden({ | ||
encourageMe(name) { | ||
log(`=> encouragementBot.encourageMe got the name: ${name}`); | ||
return `${name}, you are awesome, keep it up!`; | ||
}, | ||
}), | ||
helpers.vatID, | ||
); | ||
export function buildRootObject(vatPowers) { | ||
return harden({ | ||
encourageMe(name) { | ||
vatPowers.testLog( | ||
`=> encouragementBot.encourageMe got the name: ${name}`, | ||
); | ||
return `${name}, you are awesome, keep it up!`; | ||
}, | ||
}); | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import buildCommsDispatch from '../../src/vats/comms'; | ||
|
||
export default function setup(syscall, state, helpers) { | ||
return buildCommsDispatch(syscall, state, helpers); | ||
export default function setup(syscall, _state, _helpers, _vatPowers) { | ||
return buildCommsDispatch(syscall); | ||
} |
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
4 changes: 2 additions & 2 deletions
4
packages/SwingSet/demo/encouragementBotComms/vat-usercomms.js
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import buildCommsDispatch from '../../src/vats/comms'; | ||
|
||
export default function setup(syscall, state, helpers) { | ||
return buildCommsDispatch(syscall, state, helpers); | ||
export default function setup(syscall, _state, _helpers, _vatPowers) { | ||
return buildCommsDispatch(syscall); | ||
} |
Oops, something went wrong.