Skip to content

Commit 68e24f9

Browse files
update searchAssets test
1 parent 6099c79 commit 68e24f9

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

clients/js/test/searchAssets.test.ts

+21-24
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,51 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
1313

1414
// When we search for an asset given its owner.
1515
const assets = await umi.rpc.searchAssets({
16-
owner: publicKey('DASPQfEAVcHp55eFmfstRduMT3dSfoTirFFsMHwUaWaz'),
16+
owner: publicKey('9Qo4631XNdLYVUw1S1iBhDmu1DtcPwHqrg5ZjPbzUqGQ'),
1717
compressed: true,
18-
jsonUri:
19-
'https://arweave.net/c9aGs5fOk7gD4wWnSvmzeqgtfxAGRgtI1jYzvl8-IVs/chiaki-violet-azure-common.json',
18+
jsonUri: "https://example.com/my-nft.json"
2019
});
2120

2221
// Then we expect to find an asset.
23-
t.true(assets.items.length > 1);
22+
t.true(assets.items.length >= 1);
2423

2524
// Then we expect the following data.
2625
t.like(assets.items[0], <DasApiAsset>{
2726
interface: 'V1_NFT',
28-
id: 'GGRbPQhwmo3dXBkJSAjMFc1QYTKGBt8qc11tTp3LkEKA',
27+
id: 'DNzerLDcC5apcAQQ2Wx3qfRK1NPP6g5Bsg11fPpWkRtA',
2928
content: {
3029
metadata: {
31-
name: 'Chiaki Azure 55',
30+
name: 'My NFT',
3231
symbol: '',
3332
},
3433
},
3534
authorities: [
3635
{
37-
address: '6FpirDzk8dXDfSHWH7FAjKSvjtMPbTBYe34bRckeRN2u',
36+
address: '8dFibVsqyHR7FXAwMuvkLMj86Xa6TAg6X1NsmHbJHTio',
3837
scopes: ['full'],
3938
},
4039
],
4140
compression: {
4241
eligible: false,
4342
compressed: true,
44-
data_hash: '29BdgNWxNB1sinkfmWKFQi3zWXRpsotp2FKoZhoqVa9F',
45-
creator_hash: 'FGAvkyrzeEgvGGMfmi6ztGpvybHMYAL9w82nx6wzLVqn',
46-
asset_hash: 'FGWfA5v5SZnpe9r32NEvDyX9hLeVEoBf3GqEkHX6YK9w',
47-
tree: 'J1imb8C8SPzofrtgCxkN4nsKwHevzxgvHGeYBKFEDEmE',
43+
data_hash: '2YDXnkcksCo3RZdVFJC8oq1CMQoYFgN6TMWnkffFrHAM',
44+
creator_hash: 'EKDHSGbrGztomDfuiV4iqiZ6LschDJPsFiXjZ83f92Md',
45+
asset_hash: '8KPK2EQ7g3edRv4au36fRNwFPcfAvP3HnH2VFqsBQje7',
46+
tree: 'Hw2qE4TKe8rt3VGWupLEH7wZtTrbBAzuU7LWBXfhGNMJ',
4847
seq: 1,
4948
leaf_id: 0,
5049
},
5150
grouping: [
5251
{
5352
group_key: 'collection',
54-
group_value: 'Dm1TRVw82roqpfqpzsFxSsWg6a4z3dku6ebVHSHuVo1c',
53+
group_value: '3KPARzW2CoGhFYMKbxjGuGQfF3w2o9shnnjKZmCHCjBU',
5554
},
5655
],
5756
royalty: {
5857
royalty_model: 'creators',
5958
target: null,
60-
percent: 0.05,
61-
basis_points: 500,
59+
percent: 0.055,
60+
basis_points: 550,
6261
primary_sale_happened: false,
6362
locked: false,
6463
},
@@ -71,7 +70,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
7170

7271
// When we search for assets given their collection.
7372
const assets = await umi.rpc.searchAssets({
74-
grouping: ['collection', 'Dm1TRVw82roqpfqpzsFxSsWg6a4z3dku6ebVHSHuVo1c'],
73+
grouping: ['collection', '3KPARzW2CoGhFYMKbxjGuGQfF3w2o9shnnjKZmCHCjBU'],
7574
});
7675

7776
// Then we expect to find assets.
@@ -83,7 +82,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
8382
grouping: [
8483
{
8584
group_key: 'collection',
86-
group_value: 'Dm1TRVw82roqpfqpzsFxSsWg6a4z3dku6ebVHSHuVo1c',
85+
group_value: '3KPARzW2CoGhFYMKbxjGuGQfF3w2o9shnnjKZmCHCjBU',
8786
},
8887
],
8988
});
@@ -96,7 +95,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
9695

9796
// When we search for assets with display options.
9897
const assets = await umi.rpc.searchAssets({
99-
owner: publicKey('DASPQfEAVcHp55eFmfstRduMT3dSfoTirFFsMHwUaWaz'),
98+
owner: publicKey('3p1hnJ5ffeDamjAeBRReBdVfnef3jd19wBiTSLd3ikDE'),
10099
displayOptions: {
101100
showUnverifiedCollections: true,
102101
},
@@ -107,7 +106,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
107106

108107
// Find the specific asset
109108
const specificAsset = assets.items.find(
110-
(asset) => asset.id === '8bFQbnBrzeiYQabEJ1ghy5T7uFpqFzPjUGsVi3SzSMHB'
109+
(asset) => asset.id === '6gzjJWsqaPM37HyrTHxVCoysZiGA757ixwap4dY3pxh5'
111110
);
112111

113112
// Assert the asset exists and has group_definition
@@ -127,7 +126,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
127126

128127
// When we search for assets with display options.
129128
const assets = await umi.rpc.searchAssets({
130-
owner: publicKey('DASPQfEAVcHp55eFmfstRduMT3dSfoTirFFsMHwUaWaz'),
129+
owner: publicKey('3p1hnJ5ffeDamjAeBRReBdVfnef3jd19wBiTSLd3ikDE'),
131130
displayOptions: {
132131
showUnverifiedCollections: false,
133132
},
@@ -138,12 +137,10 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
138137

139138
// But not the specific asset which is not a verified part of a collection
140139
const specificAsset = assets.items.find(
141-
(asset) => asset.id === '8bFQbnBrzeiYQabEJ1ghy5T7uFpqFzPjUGsVi3SzSMHB'
140+
(asset) => asset.id === '6gzjJWsqaPM37HyrTHxVCoysZiGA757ixwap4dY3pxh5'
142141
);
143142

144-
t.assert(
145-
specificAsset === undefined,
146-
'Expected to not find the specific asset'
147-
);
143+
t.truthy(specificAsset, 'Expected to find the specific asset');
144+
t.is(specificAsset?.grouping.length, 0, 'Expected grouping array to be empty');
148145
});
149146
});

0 commit comments

Comments
 (0)