PowerShell – convert delimited record to object

Spent sometime struggling with this, so worth recording. Test. Code.

 

Advertisements

Alexa Skills: project structure

I couldn’t find anything mandating project structure. So I have taken the “speechAssets, src” pattern that you see (mostly) on the Amazon Alexa github repo, and adapted for my own wants:

For example…

 

Node.js: The [assert] package

I was tempted to write something about Assert with examples… but no point, as this person/persons has/have done a way better job than I would/could (Ed: enough).

And, in fact, this is part of a very generous GitBook:

[Later…] in fact I gave the book credit for giving more comprehensive coverage of Node.js that I assumed on first glance. This is the sum total of the book’s coverage:
NodeJs05

Regardless, thanks to Nelson/Nelsonic for at least giving us this.

 

lambda-tester: verifying callbacks

Their (see post from last night) documentation is really clear with good examples that you can easily work from.

So I’ve now moved on to trivial callback verification. Some screenshots as I inched forward…

npm install chai -g
npm install chai --savedev
npm init
mocha

 

 

Gist.

AWS Lambda/Node: starting unit testing

After some evenings of googling [AWS Lambda/Node/unit test framework] and playing with the results, I think I am pretty much up and running thanks to this person or persons…

and their excellent lambda-tester framework here and here.

For me, they have really abstracted things away well, and left very few moving parts behind to trip you up.  Thanks! 🙂

Important points:

  • Node in AWS Lambda works on a latest version of 6.10.* (I’m using 6.10.3, on Windows, FWIW). There are 2 other (earlier) supported versions – I’d stick with 6.10.
  • Sucking eggs: unless you are already clued up on AWS Lambda and Node (I’m using it for Alexa Skills, and I am a noob at this), do the Simplest Thing Possible to start with. On the Amazon side, I suggest that means the HelloWorld blueprint below. Then play with the first callback argument being null (success), and not null (failure), and see it come through when you run mocha. Point being ref Mocha: I think the lambda-tester help is pretty comprehensive for getting just enough knowledge on these supporting packages. Ping me if you want some help on this. I’m not many steps ahead of you, believe me :-). Of course, Hello World gives you nothing useful of itself. But this exercise is all about seeing the round trip working from a test to a function under test, both for a success, and for a failure.

Node: basic testing

Gist.

AWS Lambda testing: dump of notes so far

Lessons: node 6.10.3. Don’t try the current version – it won’t work.
In my js/noob world, Lambda-tester is looking the simplest way so far to test AWS Lambdas. I’m not quite there yet, but will return to this very soon.

https://www.npmjs.com/package/lambda-tester

  Id CommandLine
 -- -----------
 1 node -v
 2 npm -v
 3 function prompt(){}
 6 pwd
 7 cd C:\Github\Alexa\MagContact\src\PackageSet\test
 8 pwd
 9 ls
 10 mocha
 11 cd ..
 12 pwd
 13 mocha
 15 npm install lambda-tester --save-dev
 16 npm install nonsense --save-dev
 17 npm install nonsensex --save-dev
 18 npm install lambda-tester --save-dev
 19 ls
 20 mocha
 21 npm install mocha -g
 23 mocha
 24 Get-History

6.10.3

http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html

https://nodejs.org/en/blog/release/v6.10.3/

Windows 32-bit Installer: https://nodejs.org/dist/v6.10.3/node-v6.10.3-x86.msi
Windows 64-bit Installer: https://nodejs.org/dist/v6.10.3/node-v6.10.3-x64.msi
Windows 32-bit Binary: https://nodejs.org/dist/v6.10.3/win-x86/node.exe
Windows 64-bit Binary: https://nodejs.org/dist/v6.10.3/win-x64/node.exe

https://nodejs.org/dist/v6.10.3/node-v6.10.3-x64.msi

https://github.com/mapbox/lambda-cfn/issues/54