2020-08-26 08:55:03 +01:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import Vuex from 'vuex';
|
2022-11-04 11:48:16 +00:00
|
|
|
import { createLocalVue, shallowMount } from '@vue/test-utils';
|
2020-08-26 08:55:03 +01:00
|
|
|
|
2020-10-07 20:27:37 +01:00
|
|
|
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';
|
2022-11-04 11:48:16 +00:00
|
|
|
|
|
|
|
import AllSatellitesAuditsArea from '@/app/components/AllSatellitesAuditsArea.vue';
|
2020-08-26 08:55:03 +01:00
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
|
|
|
localVue.use(Vuex);
|
|
|
|
|
2020-10-07 20:27:37 +01:00
|
|
|
const nodeApi = new StorageNodeApi();
|
|
|
|
const nodeService = new StorageNodeService(nodeApi);
|
|
|
|
const nodeModule = newNodeModule(nodeService);
|
2020-08-26 08:55:03 +01:00
|
|
|
|
2022-11-04 11:48:16 +00:00
|
|
|
const store = new Vuex.Store({ modules: { node: nodeModule } });
|
2020-08-26 08:55:03 +01:00
|
|
|
|
|
|
|
describe('AllSatellitesAuditsArea', (): void => {
|
|
|
|
|
|
|
|
it('renders correctly with actual values', async (): Promise<void> => {
|
|
|
|
const wrapper = shallowMount(AllSatellitesAuditsArea, {
|
|
|
|
store,
|
|
|
|
localVue,
|
|
|
|
});
|
|
|
|
|
|
|
|
const satellites = new Satellites();
|
|
|
|
satellites.satellitesScores = [
|
2020-09-24 12:55:32 +01:00
|
|
|
new SatelliteScores('name1', 1, 1, 0.5),
|
2022-11-03 08:18:40 +00:00
|
|
|
new SatelliteScores('name2', 0.5, 1, 0.97),
|
|
|
|
new SatelliteScores('name3', 0.97, 1, 1),
|
2020-08-26 08:55:03 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
jest.spyOn(nodeApi, 'satellites').mockReturnValue(Promise.resolve(satellites));
|
|
|
|
|
|
|
|
await store.dispatch(NODE_ACTIONS.SELECT_SATELLITE);
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|