push
github
237 of 373 branches covered (63.54%)
Branch coverage included in aggregate %.
494 of 566 new or added lines in 12 files covered. (87.28%)
17 existing lines in 1 file now uncovered.3208 of 3588 relevant lines covered (89.41%)
5.14 hits per line
|
import { createSlice } from '@reduxjs/toolkit'; |
1✔ |
|
|
1✔ |
|
interface Banner { |
1✔ |
|
rate: number;
|
1✔ |
|
time: string; |
1✔ |
|
title: string; |
1✔ |
|
id: string; |
1✔ |
|
image: string; |
1✔ |
|
} |
1✔ |
|
|
1✔ |
|
interface InitialState { |
1✔ |
|
banners: Banner[];
|
1✔ |
|
currentBanner: number;
|
1✔ |
|
} |
1✔ |
|
|
1✔ |
|
const initialState: InitialState = {
|
1✔ |
|
banners: [],
|
1✔ |
|
currentBanner: 0
|
1✔ |
|
}; |
1✔ |
|
|
1✔ |
|
const bannerSlice = createSlice({
|
1✔ |
|
name: 'banner', |
1✔ |
|
initialState: initialState, |
1✔ |
|
reducers: { |
1✔ |
|
setBanners: (state, action) => {
|
|
|
state.banners = action.payload; |
3✔ |
|
}, |
3✔ |
|
setCurrentBanner: (state, action) => {
|
1✔ |
NEW
|
state.currentBanner = action.payload; |
× |
NEW
|
} |
× |
|
} |
1✔ |
|
}); |
1✔ |
|
|
1✔ |
|
export const { setBanners, setCurrentBanner } = bannerSlice.actions; |
1✔ |
|
export default bannerSlice.reducer; |
1✔ |