github
228 of 365 branches covered (62.47%)
Branch coverage included in aggregate %.
474 of 553 new or added lines in 13 files covered. (85.71%)
17 existing lines in 1 file now uncovered.3168 of 3575 relevant lines covered (88.62%)
4.22 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; |
2✔ |
|
}, |
2✔ |
|
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✔ |