Skip to content

Commit

Permalink
Merge pull request #938 from bcgov/bugfix/taaBadge
Browse files Browse the repository at this point in the history
Issuer badge display issue with TAA
  • Loading branch information
esune authored Dec 6, 2023
2 parents 1d5f764 + 2abb7f1 commit 67ec38f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 12 deletions.
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

0 comments on commit 67ec38f

Please sign in to comment.