Skip to content

Commit 82f7c69

Browse files
lint tests
1 parent ec8637d commit 82f7c69

6 files changed

+63
-34
lines changed

clients/js/test/getAsset.test.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
7676
const assetId = publicKey('5smGnzgaMsQ3JV7jWCvSxnRkHjP2dJoi1uczHTx87tji');
7777

7878
// When we fetch the asset using its ID with display options.
79-
await t.throwsAsync(async () => {
80-
await umi.rpc.getAsset({
81-
assetId,
82-
options: { showUnverifiedCollections: false },
83-
});
84-
}, {
85-
message: /Asset not found/
86-
});
79+
await t.throwsAsync(
80+
async () => {
81+
await umi.rpc.getAsset({
82+
assetId,
83+
options: { showUnverifiedCollections: false },
84+
});
85+
},
86+
{
87+
message: /Asset not found/,
88+
}
89+
);
8790
});
8891

8992
test(`it can fetch a regular asset by ID with unverified collection data using showUnverifiedCollections true (${endpoint.name})`, async (t) => {
@@ -113,5 +116,4 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
113116
verified: false,
114117
});
115118
});
116-
117119
});

clients/js/test/getAssets.test.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
117117
const assetWithCollectionMetadata = assets.find(
118118
(asset) => asset.grouping[0]?.collection_metadata
119119
);
120-
t.truthy(assetWithCollectionMetadata, 'Expected to find an asset with collection metadata');
120+
t.truthy(
121+
assetWithCollectionMetadata,
122+
'Expected to find an asset with collection metadata'
123+
);
121124
if (!assetWithCollectionMetadata) return;
122125

123126
t.like(assetWithCollectionMetadata.grouping[0], {
@@ -127,9 +130,11 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
127130
collection_metadata: {
128131
name: 'Chiaki Azure 55 Collection',
129132
symbol: '',
130-
image: 'https://arweave.net/fFcYDkRHF-936IbAZ3pLTmFAmxF1WlW3KwWndYPgI8Q/chiaki-violet-azure-common.png',
131-
description: 'MONMONMON is a collection from the creativity of Peelander Yellow. Each MONMONMON has unique and kind abilities that can be used to help others and play with your friends. There are secrets in each MONMONMON. We love you.'
132-
}
133+
image:
134+
'https://arweave.net/fFcYDkRHF-936IbAZ3pLTmFAmxF1WlW3KwWndYPgI8Q/chiaki-violet-azure-common.png',
135+
description:
136+
'MONMONMON is a collection from the creativity of Peelander Yellow. Each MONMONMON has unique and kind abilities that can be used to help others and play with your friends. There are secrets in each MONMONMON. We love you.',
137+
},
133138
});
134139
});
135140

@@ -153,7 +158,9 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
153158

154159
// Then we expect to get both assets back.
155160
t.is(assets.length, 2);
156-
const fungibleAsset = assets.find(asset => asset.interface === 'FungibleToken');
161+
const fungibleAsset = assets.find(
162+
(asset) => asset.interface === 'FungibleToken'
163+
);
157164
t.truthy(fungibleAsset, 'Expected to find a fungible token');
158165
t.deepEqual(fungibleAsset?.id, fungibleAssetId);
159166
});

clients/js/test/getAssetsByAuthority.test.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
113113
const assetWithCollectionMetadata = assets.items.find(
114114
(asset) => asset.grouping.length > 0
115115
);
116-
t.truthy(assetWithCollectionMetadata, 'Expected to find an asset with grouping');
116+
t.truthy(
117+
assetWithCollectionMetadata,
118+
'Expected to find an asset with grouping'
119+
);
117120
if (!assetWithCollectionMetadata) return;
118-
121+
119122
const collectionGroup = assetWithCollectionMetadata.grouping.find(
120123
(group) => group.group_key === 'collection'
121124
);
@@ -126,9 +129,11 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
126129
collection_metadata: {
127130
name: 'Chiaki Azure 55 Collection',
128131
symbol: '',
129-
image: 'https://arweave.net/fFcYDkRHF-936IbAZ3pLTmFAmxF1WlW3KwWndYPgI8Q/chiaki-violet-azure-common.png',
130-
description: 'MONMONMON is a collection from the creativity of Peelander Yellow. Each MONMONMON has unique and kind abilities that can be used to help others and play with your friends. There are secrets in each MONMONMON. We love you.'
131-
}
132+
image:
133+
'https://arweave.net/fFcYDkRHF-936IbAZ3pLTmFAmxF1WlW3KwWndYPgI8Q/chiaki-violet-azure-common.png',
134+
description:
135+
'MONMONMON is a collection from the creativity of Peelander Yellow. Each MONMONMON has unique and kind abilities that can be used to help others and play with your friends. There are secrets in each MONMONMON. We love you.',
136+
},
132137
});
133138
});
134139
});

clients/js/test/getAssetsByCreator.test.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
151151
const assetWithCollection = assets.items.find((asset) =>
152152
asset.grouping?.some((group) => group.group_key === 'collection')
153153
);
154-
t.truthy(assetWithCollection, 'Expected to find at least one asset with a collection');
154+
t.truthy(
155+
assetWithCollection,
156+
'Expected to find at least one asset with a collection'
157+
);
155158

156159
// We've verified assetWithCollection exists with t.truthy above
157160
const collectionGroup = assetWithCollection!.grouping.find(
@@ -164,11 +167,12 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
164167
collection_metadata: {
165168
name: 'My cNFT Collection',
166169
symbol: '',
167-
image: 'https://gateway.irys.xyz/8da3Er9Q39QRkdNhBNP7w5hDo5ZnydLNxLqe9i6s1Nak',
170+
image:
171+
'https://gateway.irys.xyz/8da3Er9Q39QRkdNhBNP7w5hDo5ZnydLNxLqe9i6s1Nak',
168172
// TODO: Needs to be added again after MTG-1380 is merged
169-
// description: '',
170-
// external_url: ''
171-
}
173+
// description: '',
174+
// external_url: ''
175+
},
172176
});
173177
});
174178
});

clients/js/test/getAssetsByOwner.test.ts

+19-8
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
8888
const assetWithCollection = assets.items.find((asset) =>
8989
asset.grouping?.some((group) => group.group_key === 'collection')
9090
);
91-
t.truthy(assetWithCollection, 'Expected to find at least one asset with a collection');
91+
t.truthy(
92+
assetWithCollection,
93+
'Expected to find at least one asset with a collection'
94+
);
9295

9396
const collectionGroup = assetWithCollection!.grouping.find(
9497
(group) => group.group_key === 'collection'
@@ -100,11 +103,12 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
100103
collection_metadata: {
101104
name: 'My cNFT Collection',
102105
symbol: '',
103-
image: 'https://gateway.irys.xyz/8da3Er9Q39QRkdNhBNP7w5hDo5ZnydLNxLqe9i6s1Nak',
106+
image:
107+
'https://gateway.irys.xyz/8da3Er9Q39QRkdNhBNP7w5hDo5ZnydLNxLqe9i6s1Nak',
104108
// TODO: Needs to be added again after MTG-1380 is merged
105-
// description: '',
106-
// external_url: ''
107-
}
109+
// description: '',
110+
// external_url: ''
111+
},
108112
});
109113
});
110114

@@ -134,8 +138,13 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
134138
});
135139

136140
// And at least one asset should be a fungible token
137-
const fungibleAsset = assets.items.find((asset) => asset.interface === 'FungibleToken');
138-
t.truthy(fungibleAsset, 'Expected to find at least one fungible token asset');
141+
const fungibleAsset = assets.items.find(
142+
(asset) => asset.interface === 'FungibleToken'
143+
);
144+
t.truthy(
145+
fungibleAsset,
146+
'Expected to find at least one fungible token asset'
147+
);
139148
});
140149

141150
test(`it can fetch assets by owner with showFungible false (${endpoint.name})`, async (t) => {
@@ -164,7 +173,9 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
164173
});
165174

166175
// And no asset should be a fungible token
167-
const fungibleAsset = assets.items.find((asset) => asset.interface === 'FungibleToken');
176+
const fungibleAsset = assets.items.find(
177+
(asset) => asset.interface === 'FungibleToken'
178+
);
168179
t.falsy(fungibleAsset, 'Expected not to find any fungible token assets');
169180
});
170181
});

clients/js/test/searchAssets.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
109109
const specificAsset = assets.items.find(
110110
(asset) => asset.id === 'JDforNYS5Bop4VdZyGCjcUyy1mYZKR4eDveqjZnRYXzy'
111111
);
112-
112+
113113
// Assert the asset exists and has group_definition
114114
t.truthy(specificAsset, 'Expected to find the specific asset');
115115
if (specificAsset) {
@@ -140,7 +140,7 @@ DAS_API_ENDPOINTS.forEach((endpoint) => {
140140
const specificAsset = assets.items.find(
141141
(asset) => asset.id === 'JDforNYS5Bop4VdZyGCjcUyy1mYZKR4eDveqjZnRYXzy'
142142
);
143-
143+
144144
// Assert the asset exists and does not have group_definition
145145
t.truthy(specificAsset, 'Expected to find the specific asset');
146146
if (specificAsset) {

0 commit comments

Comments
 (0)