storj/web/storagenode/tests/unit/components/AllSatellitesAuditsArea.spec.ts
NickolaiYurchenko 9247883c64 web/storagenode: list of audits and suspension scores
WHAT:
list of suspension and audit scores by each satellite

WHY:
a way to show audit and suspension scores of all satellite when no satellite selected

Change-Id: I4b3ac55c2da826e50131a2381c004493d82c5d5b
2020-09-02 17:27:23 +00:00

43 lines
1.3 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import Vuex from 'vuex';
import AllSatellitesAuditsArea from '@/app/components/AllSatellitesAuditsArea.vue';
import { makeNodeModule, NODE_ACTIONS, NODE_MUTATIONS } from '@/app/store/modules/node';
import { SNOApi } from '@/storagenode/api/storagenode';
import { Satellites, SatelliteScores } from '@/storagenode/satellite';
import { createLocalVue, shallowMount } from '@vue/test-utils';
const localVue = createLocalVue();
localVue.use(Vuex);
const nodeApi = new SNOApi();
const nodeModule = makeNodeModule(nodeApi);
const store = new Vuex.Store({ modules: { node: nodeModule }});
describe('AllSatellitesAuditsArea', (): void => {
it('renders correctly with actual values', async (): Promise<void> => {
const wrapper = shallowMount(AllSatellitesAuditsArea, {
store,
localVue,
});
const satellites = new Satellites();
satellites.satellitesScores = [
new SatelliteScores('name1', 1, 1),
new SatelliteScores('name2', 0.5, 1),
new SatelliteScores('name3', 0.7, 1),
];
jest.spyOn(nodeApi, 'satellites').mockReturnValue(Promise.resolve(satellites));
await store.dispatch(NODE_ACTIONS.SELECT_SATELLITE);
expect(wrapper).toMatchSnapshot();
});
});