Skip to content

Instantly share code, notes, and snippets.

@lstebner
Created July 25, 2016 01:03
Show Gist options
  • Save lstebner/7285837d265b6e2223ff4e26a59e1703 to your computer and use it in GitHub Desktop.
Save lstebner/7285837d265b6e2223ff4e26a59e1703 to your computer and use it in GitHub Desktop.
writing and running specs is always rewarding
Lukes-MacBook-Pro-2:beatlab luke$ mocha spec/beatlab_spec.js
BeatsData
#config
✓ creates a config by default
✓ allows config to be overridden from constructor
✓ allows config to be overridden after construction
#process chunk
✓ properly read data keys
✓ properly imported raw beats
✓ properly imported collections
✓ properly imported refs
#get_blocks
✓ should return all blocks by default
✓ should return blocks by type when specified
#get_beat_from_ref
✓ should return a beat by ref
✓ should return false for a bad ref
#process_line
✓ should start a collection block
✓ should end a block with 'end'
✓ should store a beat and ref
✓ should add a beat to a collection when processing a collection
#store_data_keys
✓ should store data keys from a comma separated line
✓ should store data keys when given an array of keys
#default_beat_data_clone
✓ should return some defaults
✓ should append any data keys that are not defaults
✓ should cache the defaults when called multiple times
#start_block
✓ should store the type as meta info when starting a block
✓ should begin processing a block when requested
✓ should set default meta data when starting a known block type
✓ should only set type when starting an unknown block type
✓ should accept custom values in the block opening line
✓ should accept custom keys with custom values in the block opening
#end_block
✓ should reset processing_block
✓ should add block data to blocks
#store_beat
✓ should add new beats to _all_beats
✓ should store a ref for a new beat
✓ should assign the collection automatically when processing a collection
✓ should append the s3 path to a beat source when configured to use s3
✓ should append the base dir to a beat source when configured not to use s3
✓ should know how to parse tags in to an array
34 passing (45ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment