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);
// 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).toHaveLength(1);
});
@ -229,12 +229,12 @@ const namingTests = () => {
expect(latest.height).toBeDefined();
// 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).toHaveLength(0);
// 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).toHaveLength(1);
});

View File

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