Skip to content

Commit

Permalink
identities claim bin test
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacasolin committed Dec 2, 2021
1 parent 73ba275 commit d84a164
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tests/bin/identities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('CLI Identities', () => {
keynode.id = polykeyAgent.nodeManager.getNodeId();

testProvider = new TestProvider();
await polykeyAgent.identitiesManager.registerProvider(testProvider);
polykeyAgent.identitiesManager.registerProvider(testProvider);

// Authorize session
await utils.pkStdio(
Expand Down Expand Up @@ -543,10 +543,10 @@ describe('CLI Identities', () => {
expect(result.exitCode === 0).toBeFalsy(); // Fails..
});
});
describe('commandClaimKeynode', () => {
test('Should claim a keynode.', async () => {
describe.only('commandClaimIdentity', () => {
test('Should claim an identity.', async () => {
// Need an authenticated identity.
await polykeyAgent.identities.putToken(
await polykeyAgent.identitiesManager.putToken(
testToken.providerId,
testToken.identityId,
testToken.tokenData,
Expand All @@ -562,15 +562,19 @@ describe('CLI Identities', () => {
];
const result = await testUtils.pkStdio(commands, {}, dataDir);
expect(result.exitCode).toBe(0); // Succeeds.

const gestalt = await polykeyAgent.gestaltGraph.getGestaltByIdentity(
expect(result.stdout).toContain(testToken.providerId);
});
test('Should fail for unauthenticated identities.', async () => {
const commands = [
'identities',
'claim',
'-np',
nodePath,
testToken.providerId,
testToken.identityId,
);
const gestaltString = JSON.stringify(gestalt);
expect(gestaltString).toContain(testToken.providerId);
expect(gestaltString).toContain(testToken.identityId);
expect(gestaltString).toContain(keynode.id);
];
const result = await testUtils.pkStdio(commands, {}, dataDir);
expect(result.exitCode === 0).toBeFalsy(); // Fails..
});
});
describe('commandAuthenticateProvider', () => {
Expand Down Expand Up @@ -734,8 +738,8 @@ describe('CLI Identities', () => {
await nodeB.gestaltGraph.clearDB();
await nodeC.gestaltGraph.clearDB();
});
test.only('Should start discovery by Node', async () => {
await polykeyAgent.identities.putToken(
test('Should start discovery by Node', async () => {
await polykeyAgent.identitiesManager.putToken(
testToken.providerId,
testToken.identityId,
testToken.tokenData,
Expand All @@ -760,7 +764,7 @@ describe('CLI Identities', () => {
expect(gestaltString).toContain(identityId);
});
test('Should start discovery by Identity', async () => {
await polykeyAgent.identities.putToken(
await polykeyAgent.identitiesManager.putToken(
testToken.providerId,
testToken.identityId,
testToken.tokenData,
Expand Down

0 comments on commit d84a164

Please sign in to comment.