fix failing tests

This commit is contained in:
0xmuralik 2023-01-03 14:50:38 +05:30
parent 0ace77c778
commit e8a56f2b97
3 changed files with 11 additions and 10 deletions

View File

@ -119,7 +119,7 @@ const namingTests = () => {
await registry.setName({ crn, cid: watcherId }, privateKey, fee); await registry.setName({ crn, cid: watcherId }, privateKey, fee);
// Query records should return it (some CRN points to it). // Query records should return it (some CRN points to it).
const records = await registry.queryRecords({ type: 'watcher', version: watcher.record.version }); const records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
expect(records).toBeDefined(); expect(records).toBeDefined();
expect(records).toHaveLength(1); expect(records).toHaveLength(1);
}); });
@ -229,12 +229,12 @@ const namingTests = () => {
expect(latest.height).toBeDefined(); expect(latest.height).toBeDefined();
// Query records should NOT return it (no CRN points to it). // Query records should NOT return it (no CRN points to it).
records = await registry.queryRecords({ type: 'watcher', version: watcher.record.version }); records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version });
expect(records).toBeDefined(); expect(records).toBeDefined();
expect(records).toHaveLength(0); expect(records).toHaveLength(0);
// Query all records should return it (all: true). // Query all records should return it (all: true).
records = await registry.queryRecords({ type: 'watcher', version: watcher.record.version }, true); records = await registry.queryRecords({ type: 'WebsiteRegistrationRecord', version: watcher.record.version }, true);
expect(records).toBeDefined(); expect(records).toBeDefined();
expect(records).toHaveLength(1); expect(records).toHaveLength(1);
}); });

View File

@ -45,12 +45,12 @@ describe('Querying', () => {
}); });
test('Query records by reference.', async () => { test('Query records by reference.', async () => {
const { protocol } = watcher.record; const { repo_registration_record_cid } = watcher.record;
const records = await registry.queryRecords({ protocol }, true); const records = await registry.queryRecords({ repo_registration_record_cid }, true);
expect(records.length).toBeGreaterThanOrEqual(1); expect(records.length).toBeGreaterThanOrEqual(1);
const { attributes: { protocol: recordProtocol } } = records[0]; const { attributes: { repo_registration_record_cid: record_repo_registration_record_cid } } = records[0];
expect(protocol['/']).toBe(recordProtocol['/']); expect(repo_registration_record_cid).toBe(record_repo_registration_record_cid);
}); });
test('Query records by attributes.', async () => { test('Query records by attributes.', async () => {
@ -73,7 +73,8 @@ describe('Querying', () => {
test('Query records passing refs true.', async () => { test('Query records passing refs true.', async () => {
const [record] = await registry.getRecordsByIds([watcher.id], true); const [record] = await registry.getRecordsByIds([watcher.id], true);
expect(record.id).toBe(watcher.id); expect(record.id).toBe(watcher.id);
expect(record.references).toBeDefined(); // temp fix
expect(record.references).toHaveLength(1); expect(record.attributes.repo_registration_record_cid).toBeDefined();
expect(record.attributes.repo_registration_record_cid).toHaveLength(46);
}); });
}); });

View File

@ -4,4 +4,4 @@ record:
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.11 version: 1.0.0