Skip to content

Commit

Permalink
add comment about tests and skip them again for the ci
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Oct 25, 2024
1 parent 7b09016 commit 2164072
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 105 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ The worker uses the webcrypto api if it is run in the browser. This library is o
defined if you access the webpage with `localhost` in firefox. It is not available
on `127.0.0.1` or `0.0.0.0` due to browser security policies.

## Testing
Use the below command to only execute a particular test suite.

**Note:** The worker tests are skipped by default, as they need a running setup.

```bash
// execute worker tests
yarn test --runTestsByPath packages/worker-api/src/integriteeWorker.spec.ts
```

```bash
yarn add @encointer/node-api @encointer/worker-api
Expand Down
210 changes: 106 additions & 104 deletions packages/worker-api/src/integriteeWorker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,79 +42,79 @@ describe('worker', () => {
// skip it, as this requires a worker (and hence a node) to be running
// To my knowledge jest does not have an option to run skipped tests specifically, does it?
// Todo: add proper CI to test this too.
describe('needs worker and node running', () => {
// describe('getWorkerPubKey', () => {
// it('should return value', async () => {
// const result = await worker.getShieldingKey();
// // console.log('Shielding Key', result);
// expect(result).toBeDefined();
// });
// });
//
// describe('getShardVault', () => {
// it('should return value', async () => {
// const result = await worker.getShardVault();
// console.log('ShardVault', result.toHuman());
// expect(result).toBeDefined();
// });
// });
//
// describe('getNonce', () => {
// it('should return value', async () => {
// const result = await worker.getNonce(alice, network.shard);
// console.log('Nonce', result.toHuman);
// expect(result).toBeDefined();
// });
// });
//
//
// describe('getAccountInfo', () => {
// it('should return value', async () => {
// const result = await worker.getAccountInfo(alice, network.shard);
// console.log('getAccountInfo', result.toHuman());
// expect(result).toBeDefined();
// });
// });
//
// describe('accountInfoGetter', () => {
// it('should return value', async () => {
// const getter = await worker.accountInfoGetter(charlie, network.shard);
// console.log(`AccountInfoGetter: ${JSON.stringify(getter)}`);
// const result = await getter.send();
// console.log('getAccountInfo:', result.toHuman());
// expect(result).toBeDefined();
// });
// });
//
// describe('parentchainsInfoGetter', () => {
// it('should return value', async () => {
// const getter = worker.parentchainsInfoGetter(network.shard);
// console.log(`parentchainsInfoGetter: ${JSON.stringify(getter)}`);
// const result = await getter.send();
// console.log('parentchainsInfoGetter:', result.toHuman());
// expect(result).toBeDefined();
// });
// });
//
// describe('guessTheNumberInfoGetter', () => {
// it('should return value', async () => {
// const getter = worker.guessTheNumberInfoGetter(network.shard);
// console.log(`GuessTheNumberInfo: ${JSON.stringify(getter)}`);
// const result = await getter.send();
// console.log('GuessTheNumberInfo:', result.toHuman());
// expect(result).toBeDefined();
// });
// });
//
// describe('guessTheNumberAttemptsGetter', () => {
// it('should return value', async () => {
// const getter = await worker.guessTheNumberAttemptsTrustedGetter(charlie, network.shard);
// console.log(`Attempts: ${JSON.stringify(getter)}`);
// const result = await getter.send();
// console.log('Attempts:', result.toHuman());
// expect(result).toBeDefined();
// });
// });
describe.skip('needs worker and node running', () => {
describe('getWorkerPubKey', () => {
it('should return value', async () => {
const result = await worker.getShieldingKey();
// console.log('Shielding Key', result);
expect(result).toBeDefined();
});
});

describe('getShardVault', () => {
it('should return value', async () => {
const result = await worker.getShardVault();
console.log('ShardVault', result.toHuman());
expect(result).toBeDefined();
});
});

describe('getNonce', () => {
it('should return value', async () => {
const result = await worker.getNonce(alice, network.shard);
console.log('Nonce', result.toHuman);
expect(result).toBeDefined();
});
});


describe('getAccountInfo', () => {
it('should return value', async () => {
const result = await worker.getAccountInfo(alice, network.shard);
console.log('getAccountInfo', result.toHuman());
expect(result).toBeDefined();
});
});

describe('accountInfoGetter', () => {
it('should return value', async () => {
const getter = await worker.accountInfoGetter(charlie, network.shard);
console.log(`AccountInfoGetter: ${JSON.stringify(getter)}`);
const result = await getter.send();
console.log('getAccountInfo:', result.toHuman());
expect(result).toBeDefined();
});
});

describe('parentchainsInfoGetter', () => {
it('should return value', async () => {
const getter = worker.parentchainsInfoGetter(network.shard);
console.log(`parentchainsInfoGetter: ${JSON.stringify(getter)}`);
const result = await getter.send();
console.log('parentchainsInfoGetter:', result.toHuman());
expect(result).toBeDefined();
});
});

describe('guessTheNumberInfoGetter', () => {
it('should return value', async () => {
const getter = worker.guessTheNumberInfoGetter(network.shard);
console.log(`GuessTheNumberInfo: ${JSON.stringify(getter)}`);
const result = await getter.send();
console.log('GuessTheNumberInfo:', result.toHuman());
expect(result).toBeDefined();
});
});

describe('guessTheNumberAttemptsGetter', () => {
it('should return value', async () => {
const getter = await worker.guessTheNumberAttemptsTrustedGetter(charlie, network.shard);
console.log(`Attempts: ${JSON.stringify(getter)}`);
const result = await getter.send();
console.log('Attempts:', result.toHuman());
expect(result).toBeDefined();
});
});

describe('balance transfer should work', () => {
it('should return value', async () => {
Expand All @@ -132,36 +132,38 @@ describe('worker', () => {
});
});

// describe('balance unshield should work', () => {
// it('should return value', async () => {
// const shard = network.shard;
//
// const result = await worker.balanceUnshieldFunds(
// alice,
// shard,
// network.mrenclave,
// alice.address,
// charlie.address,
// 1100000000000,
// );
// console.log('balance unshield result', JSON.stringify(result));
// expect(result).toBeDefined();
// });
// });
//
// describe('guess the number should work', () => {
// it('should return value', async () => {
// const shard = network.shard;
//
// const result = await worker.guessTheNumber(
// alice,
// shard,
// network.mrenclave,
// 1,
// );
// console.log('guess the number result', JSON.stringify(result));
// expect(result).toBeDefined();
// });
// });
// race condition so skipped
describe.skip('balance unshield should work', () => {
it('should return value', async () => {
const shard = network.shard;

const result = await worker.balanceUnshieldFunds(
alice,
shard,
network.mrenclave,
alice.address,
charlie.address,
1100000000000,
);
console.log('balance unshield result', JSON.stringify(result));
expect(result).toBeDefined();
});
});

// race condition, so skipped
describe.skip('guess the number should work', () => {
it('should return value', async () => {
const shard = network.shard;

const result = await worker.guessTheNumber(
alice,
shard,
network.mrenclave,
1,
);
console.log('guess the number result', JSON.stringify(result));
expect(result).toBeDefined();
});
});
});
});
2 changes: 1 addition & 1 deletion packages/worker-api/src/worker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('worker', () => {
// skip it, as this requires a worker (and hence a node) to be running
// To my knowledge jest does not have an option to run skipped tests specifically, does it?
// Todo: add proper CI to test this too.
describe('needs worker and node running', () => {
describe.skip('needs worker and node running', () => {
describe('getWorkerPubKey', () => {
it('should return value', async () => {
const result = await worker.getShieldingKey();
Expand Down

0 comments on commit 2164072

Please sign in to comment.