-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added badge in README.md - Added coverage - Added coveralls - Added more tests for coverage - Added an index coverage file, so we know everything of exported files
- Loading branch information
Pierre-Alexandre St-Jean
committed
Apr 26, 2016
1 parent
99689b5
commit 4ef7beb
Showing
10 changed files
with
78 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
.DS_STORE | ||
|
||
dist/* | ||
dist_test/* | ||
node_modules/* | ||
typings/* | ||
# Package management | ||
node_modules | ||
typings | ||
npm-debug.log | ||
|
||
# Build files | ||
dist | ||
dist_test | ||
.nyc_output | ||
node_modules |
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 |
---|---|---|
|
@@ -5,9 +5,12 @@ | |
"main": "dist/index.js", | ||
"browser": "dist/bundle.js", | ||
"scripts": { | ||
"lint": "tslint -s \"node_modules/tslint-loader/formatters/\" \"test/**/*.ts\" \"src/**/*.ts\"", | ||
"build:webpack": "webpack", | ||
"build:tsc": "tsc", | ||
"test": "tsc -p tsconfig.test.json && ava \"**/*test.js\"", | ||
"build": "npm run-script lint && npm run-script build:webpack && npm run-script build:tsc", | ||
"test": "tsc -p tsconfig.test.json && nyc ava \"**/*test.js\"", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls", | ||
"clean": "rm -rf dist/*" | ||
}, | ||
"author": "Pierre-Alexandre St-Jean <[email protected]>", | ||
|
@@ -17,13 +20,15 @@ | |
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"ava": "^0.14.0", | ||
"ava": "0.14.0", | ||
"coveralls": "^2.11.9", | ||
"es6-promise": "3.1.2", | ||
"exports-loader": "0.6.3", | ||
"express": "^4.13.4", | ||
"express": "4.13.4", | ||
"isomorphic-fetch": "2.2.1", | ||
"jsdom": "^8.4.0", | ||
"sinon": "^1.17.3", | ||
"jsdom": "8.4.0", | ||
"nyc": "^6.4.0", | ||
"sinon": "1.17.3", | ||
"ts-loader": "0.8.2", | ||
"tslint": "3.8.0", | ||
"tslint-loader": "2.1.3", | ||
|
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,9 +1,10 @@ | ||
import * as analytics from './analytics'; | ||
import * as SimpleAnalytics from './simpleanalytics'; | ||
import * as history from './history'; | ||
|
||
import * as donottrack from './donottrack'; | ||
export { | ||
analytics, | ||
donottrack, | ||
history, | ||
SimpleAnalytics | ||
} |
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,33 +1,32 @@ | ||
import test from 'ava'; | ||
import * as analytics from '../src/analytics'; | ||
|
||
import * as express from 'express'; | ||
import * as http from 'http'; | ||
|
||
var app:express.Application = express(); | ||
const server: http.Server = (<any>http).createServer(app).listen() | ||
var app: express.Application = express(); | ||
const server: http.Server = (<any>http).createServer(app).listen(); | ||
app.set('port', server.address().port); | ||
|
||
test('Analytics: can post a view event', t => { | ||
|
||
const response : analytics.ViewEventResponse = { | ||
raw:undefined, | ||
const response: analytics.ViewEventResponse = { | ||
raw: undefined, | ||
visitId : '123', | ||
visitorId: '213' | ||
} | ||
}; | ||
|
||
app.post('/analytics/view',(req,res) => { | ||
app.post('/analytics/view', (req, res) => { | ||
res.status(200).send(JSON.stringify(response)); | ||
}); | ||
|
||
const client = new analytics.Client({ | ||
token: 'token', | ||
endpoint:`http://localhost:${server.address().port}` | ||
endpoint: `http://localhost:${server.address().port}` | ||
}); | ||
return client.sendViewEvent({location:'here'}).then((res: analytics.ViewEventResponse)=> { | ||
t.not(res.raw,undefined); | ||
t.is(res.visitId,response.visitId); | ||
t.is(res.visitorId,response.visitorId); | ||
|
||
return client.sendViewEvent({location: 'here'}).then((res: analytics.ViewEventResponse) => { | ||
t.not(res.raw, undefined); | ||
t.is(res.visitId, response.visitId); | ||
t.is(res.visitorId, response.visitorId); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import test from 'ava'; | ||
import * as coveoanalytics from '../src/index'; | ||
|
||
test('coverage', t => { | ||
const _ = coveoanalytics; | ||
}); |
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