Skip to content

Commit 2ad9d84

Browse files
committed
Unit testing api requests
1 parent 105ced5 commit 2ad9d84

File tree

10 files changed

+291
-52
lines changed

10 files changed

+291
-52
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ You can access the Mux Data API in the same way by using your Data instance. For
4444
values across every breakdown for the `aggregate_startup_time` metric by using the below function.
4545

4646
```
47-
Data.metrics.breakdown('aggregate_startup_time', {group_by: 'browser'});
47+
Data.metrics.breakdown('aggregate_startup_time', { group_by: 'browser' });
4848
```
4949

5050
Every function will return a chainable [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).

manual/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ You can access the Mux Data API in the same way by using your Data instance. For
4444
values across every breakdown for the `aggregate_startup_time` metric by using the below function.
4545

4646
```
47-
Data.metrics.breakdown('aggregate_startup_time', queryParams);
47+
Data.metrics.breakdown('aggregate_startup_time', { group_by: 'browser' });
4848
```
4949

50-
Every function will return a chainable [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
51-
50+
Every function will return a chainable [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
5251
See the [Mux-Node docs] for a list of all available functions.
5352

5453
## Development

package-lock.json

Lines changed: 125 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"video",
88
"video encoding",
99
"video transcoding",
10-
"api"
10+
"api",
11+
"video analytics"
1112
],
1213
"private": true,
1314
"author": "Mux <[email protected]> (https://mux.com/)",
@@ -32,6 +33,7 @@
3233
"eslint-plugin-import": "^2.9.0",
3334
"eslint-plugin-node": "^6.0.1",
3435
"mocha": "^5.1.1",
36+
"moxios": "^0.4.0",
3537
"sinon": "^4.5.0"
3638
}
3739
}

src/data/data.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ class Data {
3737

3838
/** @type {Metrics} */
3939
this.metrics = new Metrics(accessToken, secret);
40+
4041
/** @type {Errors} */
4142
this.errors = new Errors(accessToken, secret);
43+
4244
/** @type {Filters} */
4345
this.filters = new Filters(accessToken, secret);
46+
4447
/** @type {Exports} */
4548
this.exports = new Exports(accessToken, secret);
49+
4650
/** @type {VideoViews} */
4751
this.videoViews = new VideoViews(accessToken, secret);
4852
}

0 commit comments

Comments
 (0)