1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "targetActorId": "ryanclinton/fred-economic-data",
12 "testCases": [
13 {
14 "name": "Smoke test - GDP data",
15 "input": {
16 "seriesId": "GDP",
17 "maxResults": 3
18 },
19 "assertions": {
20 "minResults": 1,
21 "requiredFields": [
22 "seriesId",
23 "value",
24 "date"
25 ],
26 "maxDuration": 60
27 }
28 }
29 ]
30};
31
32
33const run = await client.actor("ryanclinton/actor-test-runner").call(input);
34
35
36console.log('Results from dataset');
37console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
38const { items } = await client.dataset(run.defaultDatasetId).listItems();
39items.forEach((item) => {
40 console.dir(item);
41});
42
43