Skip to content

Commit d2a11f3

Browse files
committed
refactor: improved test
1 parent af0f70b commit d2a11f3

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

test/e2e/sdk/publicUrl/src/main.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { Actor, log } from 'apify';
22

3-
// Also needs to be changed in test.mjs
4-
const PUBLIC_RECORD_KEY = 'public-record-key';
5-
const PUBLIC_DATA = { exposedData: 'test' };
6-
73
await Actor.init();
84

9-
await Actor.setValue(PUBLIC_RECORD_KEY, JSON.stringify(PUBLIC_DATA), { contentType: `application/json` });
5+
const { data, recordKey } = await Actor.getInput();
6+
7+
await Actor.setValue(recordKey, JSON.stringify(data), { contentType: `application/json` });
108

119
const defaultKeyValueStore = await Actor.openKeyValueStore();
12-
const publicUrl = defaultKeyValueStore.getPublicUrl(PUBLIC_RECORD_KEY);
10+
const publicUrl = defaultKeyValueStore.getPublicUrl(recordKey);
1311

1412
// Here we store the url itself
1513
await Actor.setValue('urlToPublicData', publicUrl);

test/e2e/sdk/publicUrl/test.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import assert from 'node:assert/strict';
22

33
import { ApifyClient } from 'apify';
44

5-
// Also needs to be changed in main.mjs
65
const PUBLIC_DATA = { exposedData: 'test' };
76

87
const client = new ApifyClient({
@@ -11,7 +10,7 @@ const client = new ApifyClient({
1110

1211
const actor = client.actor(process.argv[2]);
1312

14-
const run = await actor.call({}, { waitSecs: 15 });
13+
const run = await actor.call({ data: PUBLIC_DATA, recordKey: 'public-record-key' }, { waitSecs: 15 });
1514
assert.equal(run.exitCode, 0);
1615

1716
const publicUrl = await client.keyValueStore(run.defaultKeyValueStoreId).getRecord('urlToPublicData');

0 commit comments

Comments
 (0)