musora-content-services 1.3.5 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node.js.yml +0 -0
- package/CHANGELOG.md +6 -0
- package/README.md +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/link_mcs.sh +0 -0
- package/package.json +1 -1
- package/src/filterBuilder.js +11 -11
- package/src/index.d.ts +250 -227
- package/src/index.js +249 -226
- package/src/services/dataContext.js +26 -5
- package/src/services/sanity.js +60 -16
- package/test/dataContext.test.js +38 -0
- package/test/sanityQueryService.test.js +16 -6
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { initializeTestService } from './initializeTests'
|
|
2
|
+
import { DataContext } from '../src/services/dataContext.js'
|
|
3
|
+
|
|
4
|
+
describe('dataContext', function () {
|
|
5
|
+
let mock = null
|
|
6
|
+
let testVersion = 1
|
|
7
|
+
const dataVersionKey = 1
|
|
8
|
+
const dataContext = new DataContext(dataVersionKey, null)
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
initializeTestService()
|
|
12
|
+
mock = jest.spyOn(dataContext, 'fetchData')
|
|
13
|
+
mock.mockImplementation(() =>
|
|
14
|
+
JSON.parse(`{"version":${testVersion},"data":[308516,308515,308514,308518]}`)
|
|
15
|
+
)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('verifyLocalData', async () => {
|
|
19
|
+
//force load data into context and verify version 1 loaded
|
|
20
|
+
await dataContext.getData()
|
|
21
|
+
expect(dataContext.version()).toBe(1)
|
|
22
|
+
|
|
23
|
+
//increment source version and verify data context still uses old version
|
|
24
|
+
testVersion++
|
|
25
|
+
await dataContext.getData()
|
|
26
|
+
expect(dataContext.version()).toBe(1)
|
|
27
|
+
|
|
28
|
+
//verifyLocalData with old source version and verify context still uses old version
|
|
29
|
+
await DataContext.verifyLocalData(1, 1)
|
|
30
|
+
await dataContext.getData()
|
|
31
|
+
expect(dataContext.version()).toBe(1)
|
|
32
|
+
|
|
33
|
+
//verifyLocalData with new source version and verify context loads new version
|
|
34
|
+
await DataContext.verifyLocalData(1, 2)
|
|
35
|
+
await dataContext.getData()
|
|
36
|
+
expect(dataContext.version()).toBe(2)
|
|
37
|
+
})
|
|
38
|
+
})
|
|
@@ -14,8 +14,9 @@ import { fetchOwnedChallenges } from '../src'
|
|
|
14
14
|
const {
|
|
15
15
|
fetchSongById,
|
|
16
16
|
fetchArtists,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
fetchReturning,
|
|
18
|
+
fetchLeaving,
|
|
19
|
+
fetchComingSoon,
|
|
19
20
|
fetchSongArtistCount,
|
|
20
21
|
fetchRelatedSongs,
|
|
21
22
|
fetchNewReleases,
|
|
@@ -58,14 +59,23 @@ describe('Sanity Queries', function () {
|
|
|
58
59
|
expect(response.id).toBe(id)
|
|
59
60
|
})
|
|
60
61
|
|
|
61
|
-
test('
|
|
62
|
+
test('fetchReturning', async () => {
|
|
62
63
|
const brand = 'guitareo'
|
|
63
|
-
const
|
|
64
|
+
const page = 1
|
|
65
|
+
const response = await fetchReturning(brand, {pageNumber: 1})
|
|
66
|
+
expect(response).toBeDefined()
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('fetchLeaving', async () => {
|
|
70
|
+
const brand = 'guitareo'
|
|
71
|
+
const response = await fetchLeaving(brand, {pageNumber: 1})
|
|
72
|
+
expect(response).toBeDefined()
|
|
64
73
|
});
|
|
65
74
|
|
|
66
|
-
test('
|
|
75
|
+
test('fetchComingSoon', async () => {
|
|
67
76
|
const brand = 'guitareo'
|
|
68
|
-
const response = await
|
|
77
|
+
const response = await fetchComingSoon(brand, {pageNumber: 2, contentPerPage: 20})
|
|
78
|
+
expect(response).toBeDefined()
|
|
69
79
|
});
|
|
70
80
|
|
|
71
81
|
|