micro-analytics / micro-analytics-cli

Public analytics as a Node.js microservice. No sysadmin experience required! πŸ“ˆ
MIT License
734 stars 39 forks source link

Add unit tests for adapters #43

Closed relekang closed 7 years ago

relekang commented 7 years ago

Usage (copied from the changes to writing-adapters.md)

const test = require('micro-analytics-cli/adapter-tests/unit-tests')

test({
 name: 'adapter-name',
 modulePath: path.resolve(__dirname, './index.js'),
})

The option object takes the following properties.

codecov-io commented 7 years ago

Codecov Report

Merging #43 into master will increase coverage by 1.81%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
+ Coverage   81.81%   83.63%   +1.81%     
==========================================
  Files           3        3              
  Lines          55       55              
  Branches       12       13       +1     
==========================================
+ Hits           45       46       +1     
+ Misses         10        9       -1
Impacted Files Coverage Ξ”
src/db.js 70% <0%> (+10%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 3f3ff19...4294132. Read the comment docs.

mxstbr commented 7 years ago

Have you tried running this with the redis adapter? Does it work??

relekang commented 7 years ago

Yes, this is with the repo linked locally.

~/dev/ma/adapter-redis(test) Β» jest
 PASS  ./test.js
  micro-analytics adapter redis
    βœ“ should save and read (17ms)
    βœ“ should return all saves on getAll (3ms)
    βœ“ should have check whether a key is stored with has (1ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        0.702s, estimated 1s
Ran all test suites.
mxstbr commented 7 years ago

Awesome, is there anything left to be done?!

relekang commented 7 years ago

No, this pr is done πŸ™‚ I will update the branch in redis repo when it is out.

mxstbr commented 7 years ago

Published as 1.2.0-10 (tagged as dev) from #31!