Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issuer badge display issue with TAA #938

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/tenant-ui/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions services/tenant-ui/frontend/src/components/about/Traction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<div class="col-12 md:col-6">
<strong>{{ $t('about.traction.info') }}</strong>
<p class="my-0">
{{ $t('about.traction.tractionVersion', { version: '0.3.6' }) }}
{{ $t('about.traction.tractionVersion', { version: '0.3.7' }) }}
</p>
<p class="mt-0">
{{ $t('about.traction.uiVersion', { version: '0.3.6' }) }}
{{ $t('about.traction.uiVersion', { version: '0.3.7' }) }}
</p>
</div>

Expand Down
9 changes: 4 additions & 5 deletions services/tenant-ui/frontend/src/store/tenantStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ export const useTenantStore = defineStore('tenant', () => {
const tenantReady = computed(() => {
return token.value != null;
});
const isIssuer = computed(() => {
const isIssuer: Ref<boolean> = computed(() => {
return (
endorserConnection.value &&
endorserConnection.value.state === 'active' &&
publicDid.value &&
publicDid.value.did
endorserConnection.value?.state === 'active' &&
publicDid.value?.did &&
(!taa.value?.taa_required || taa.value?.taa_accepted)
);
});

Expand Down
50 changes: 47 additions & 3 deletions services/tenant-ui/frontend/test/store/tenantStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,60 @@ describe('tenantStore', () => {
expect(store.tenantReady).toEqual(true);
});

// Should this function return a boolean?
test('isIssuer is truthy when endorderConnection active and has did', () => {
test('isIssuer is true when endorderConnection active and has did and TAA not required', () => {
store.endorserConnection = {
state: 'active',
};
store.publicDid = {
did: 'did',
};
store.taa = {
taa_required: false,
};
expect(store.isIssuer).toBeTruthy();
expect(store.isIssuer).toEqual(true);
});

test('isIssuer is true when endorderConnection active and has did and TAA accepted', () => {
store.endorserConnection = {
state: 'active',
};
store.publicDid = {
did: 'did',
};
store.taa = {
taa_required: true,
taa_accepted: true,
};
expect(store.isIssuer).toBeTruthy();
expect(store.isIssuer).toEqual('did');
expect(store.isIssuer).toEqual(true);
});

test('isIssuer is false when the TAA is not accepted ', () => {
store.endorserConnection = {
state: 'active',
};
store.publicDid = {
did: 'did',
};
store.taa = {
taa_required: true,
taa_accepted: false,
};
expect(store.isIssuer).toBeFalsy();
});

test('isIssuer is false when the taa_accepted is not there ', () => {
store.endorserConnection = {
state: 'active',
};
store.publicDid = {
did: 'did',
};
store.taa = {
taa_required: true,
};
expect(store.isIssuer).toBeFalsy();
});

test('isIssuer is falsy when endorserConnection is not-active', () => {
Expand Down
2 changes: 1 addition & 1 deletion services/tenant-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tenant-ui",
"version": "0.3.6",
"version": "0.3.7",
"description": "",
"main": "index.ts",
"scripts": {
Expand Down
Loading