• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ecamp / hal-json-vuex / 6631556418

24 Oct 2023 07:20PM UTC coverage: 90.85% (-0.04%) from 90.89%
6631556418

push

github

web-flow
Merge pull request #287 from usu/feat/nuxt3-vite

Feat/nuxt3 vite

120 of 143 branches covered (0.0%)

Branch coverage included in aggregate %.

13 of 13 new or added lines in 2 files covered. (100.0%)

297 of 316 relevant lines covered (93.99%)

840.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.95
/src/storeModule.ts
1
import StoreData from './interfaces/StoreData'
2

3
import { MutationTree } from 'vuex/types'
4

5
export const state = {}
9✔
6
export type State = Record<string, StoreData>
7

8
export const mutations: MutationTree<State> = {
9✔
9
  /**
10
   * Adds a placeholder into the store that indicates that the entity with the given URI is currently being
11
   * fetched from the API and not yet available.
12
   * @param state Vuex state
13
   * @param uri   URI of the object that is being fetched
14
   */
15
  addEmpty (state: State, uri: string) : void {
16
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
    // @ts-ignore
18
    state[uri] = { _meta: { self: uri, loading: true } }
621✔
19
  },
20
  /**
21
   * Adds entities loaded from the API to the Vuex store.
22
   * @param state Vuex state
23
   * @param data  An object mapping URIs to entities that should be merged into the Vuex state.
24
   */
25
  add (state: State, data: Record<string, unknown>) : void {
26
    Object.keys(data).forEach(uri => {
729✔
27
      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
      // @ts-ignore
29
      state[uri] = data[uri]
1,254✔
30

31
      state[uri]._meta.loading = false
1,254✔
32
      state[uri]._meta.reloading = false
1,254✔
33
    })
34
  },
35
  /**
36
   * Marks a single entity in the Vuex store as reloading, meaning a reloading network request is currently ongoin.
37
   * @param state Vuex state
38
   * @param uri   URI of the entity that is currently being reloaded
39
   */
40
  reloading (state: State, uri: string) : void {
41
    if (state[uri]) state[uri]._meta.reloading = true
144✔
42
  },
43
  /**
44
   * Marks a single entity in the Vuex store as normal again, after it has been marked as reloading before.
45
   * @param state Vuex state
46
   * @param uri   URI of the entity that is currently being reloaded
47
   */
48
  reloadingFailed (state: State, uri: string) : void {
49
    if (state[uri]) state[uri]._meta.reloading = false
36✔
50
  },
51
  /**
52
   * Removes a single entity from the Vuex store.
53
   * @param state Vuex state
54
   * @param uri   URI of the entity to be removed
55
   */
56
  purge (state: State, uri: string) : void {
57
    delete state[uri]
132✔
58
  },
59
  /**
60
   * Removes all entities from the Vuex store.
61
   * @param state Vuex state
62
   * @param uri   URI of the entity to be removed
63
   */
64
  purgeAll (state: State) : void {
65
    Object.keys(state).forEach(uri => {
×
66
      delete state[uri]
×
67
    })
68
  },
69
  /**
70
   * Marks a single entity in the Vuex store as deleting, meaning the process of deletion is currently ongoing.
71
   * @param state Vuex state
72
   * @param uri   URI of the entity that is currently being deleted
73
   */
74
  deleting (state: State, uri: string) : void {
75
    if (state[uri]) state[uri]._meta.deleting = true
120✔
76
  },
77
  /**
78
   * Marks a single entity in the Vuex store as normal again, after it has been marked as deleting before.
79
   * @param state Vuex state
80
   * @param uri   URI of the entity that failed to be deleted
81
   */
82
  deletingFailed (state: State, uri: string) : void {
83
    if (state[uri]) state[uri]._meta.deleting = false
×
84
  }
85
}
86

87
export default {
9✔
88
  mutations
89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc