-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
32 lines (25 loc) · 1.14 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import FS from 'fs';
import Ava from 'ava';
import AudienceProjectData from './audienceproject-data-web.js'; // eslint-disable-line import/extensions
/* eslint-disable import/no-named-as-default-member */
Ava('export methods', (test) => {
test.is(typeof AudienceProjectData, 'object');
test.is(typeof AudienceProjectData.fetch, 'function');
});
Ava('export module and package', (test) => {
const babelRC = JSON.parse(FS.readFileSync('./.babelrc'));
test.is(AudienceProjectData.moduleName, babelRC.moduleId);
const packageJSON = JSON.parse(FS.readFileSync('./package.json'));
test.is(AudienceProjectData.packageName, packageJSON.name);
test.is(AudienceProjectData.packageVersion, packageJSON.version);
});
Ava('export cache and states', (test) => {
test.is(typeof AudienceProjectData.fetchCache, 'object');
test.is(AudienceProjectData.fetchStateInitial, 'INITIAL');
test.is(AudienceProjectData.fetchStateRunning, 'RUNNING');
test.is(AudienceProjectData.fetchStateReady, 'READY');
test.is(AudienceProjectData.fetchStateFailed, 'FAILED');
});
Ava('export status', (test) => {
test.is(typeof AudienceProjectData.fetchStatus, 'object');
});