storj/web/storagenode/tests/unit/components/AllSatellitesAuditsArea.spec.ts
Vitalii 8268933b56 web/storagenode: fix linter
Fixed web linter.

Issue:
https://github.com/storj/storj/issues/5158

Change-Id: Ia63e3e6e7352a99e902c9ed08a4bcfd75059e943
2022-11-04 18:32:26 +00:00

45 lines
1.5 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { newNodeModule, NODE_ACTIONS } from '@/app/store/modules/node';
import { StorageNodeApi } from '@/storagenode/api/storagenode';
import { StorageNodeService } from '@/storagenode/sno/service';
import { Satellites, SatelliteScores } from '@/storagenode/sno/sno';
import AllSatellitesAuditsArea from '@/app/components/AllSatellitesAuditsArea.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
const nodeApi = new StorageNodeApi();
const nodeService = new StorageNodeService(nodeApi);
const nodeModule = newNodeModule(nodeService);
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, 0.5),
new SatelliteScores('name2', 0.5, 1, 0.97),
new SatelliteScores('name3', 0.97, 1, 1),
];
jest.spyOn(nodeApi, 'satellites').mockReturnValue(Promise.resolve(satellites));
await store.dispatch(NODE_ACTIONS.SELECT_SATELLITE);
expect(wrapper).toMatchSnapshot();
});
});