mirror of https://github.com/rancher/dashboard.git
standard user test fix
This commit is contained in:
parent
512f471ebe
commit
c73e737c7d
|
|
@ -128,7 +128,14 @@ export default {
|
|||
async mounted() {
|
||||
const nodeId = this.pod.spec?.nodeName;
|
||||
|
||||
await this.$store.dispatch('cluster/find', { type: NODE, id: nodeId });
|
||||
try {
|
||||
const schema = this.$store.getters[`cluster/schemaFor`](NODE);
|
||||
|
||||
if (schema) {
|
||||
await this.$store.dispatch('cluster/find', { type: NODE, id: nodeId });
|
||||
}
|
||||
} catch {}
|
||||
|
||||
await this.setupTerminal();
|
||||
await this.connect();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ jest.mock('@shell/utils/crypto', () => {
|
|||
describe('component: ContainerShell', () => {
|
||||
const action = jest.fn();
|
||||
const translate = jest.fn();
|
||||
const schemaFor = jest.fn();
|
||||
const onData = jest.fn();
|
||||
const loadAddon = jest.fn();
|
||||
const open = jest.fn();
|
||||
|
|
@ -66,7 +67,10 @@ describe('component: ContainerShell', () => {
|
|||
mocks: {
|
||||
$store: {
|
||||
dispatch: action,
|
||||
getters: { 'i18n/t': translate }
|
||||
getters: {
|
||||
'i18n/t': translate,
|
||||
'cluster/schemaFor': schemaFor
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -99,9 +103,23 @@ describe('component: ContainerShell', () => {
|
|||
expect(windowElement.exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('the find action for the node is called', async() => {
|
||||
it('the find action for the node is called if schemaFor finds a schema for NODE', async() => {
|
||||
resetMocks();
|
||||
await wrapperPostMounted(defaultContainerShellParams);
|
||||
const testSchemaFindsSchemaParams = {
|
||||
...defaultContainerShellParams,
|
||||
mocks: {
|
||||
...defaultContainerShellParams.mocks,
|
||||
$store: {
|
||||
...defaultContainerShellParams.mocks.$store,
|
||||
getters: {
|
||||
...defaultContainerShellParams.mocks.$store.getters,
|
||||
'cluster/schemaFor': jest.fn().mockImplementation(() => true)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
await wrapperPostMounted(testSchemaFindsSchemaParams);
|
||||
|
||||
const actionParams = action.mock.calls[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,13 @@ export default class Pod extends WorkloadService {
|
|||
}
|
||||
|
||||
get node() {
|
||||
this.$dispatch(`find`, { type: NODE, id: this.spec.nodeName });
|
||||
try {
|
||||
const schema = this.$store.getters[`cluster/schemaFor`](NODE);
|
||||
|
||||
if (schema) {
|
||||
this.$dispatch(`find`, { type: NODE, id: this.spec.nodeName });
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return this.$getters['byId'](NODE, this.spec.nodeName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue