فهرست منبع

complete unit tests for urlBuilder service

Olivier Massot 4 سال پیش
والد
کامیت
a73ef198f3

+ 5 - 0
notes_relecture.md

@@ -20,6 +20,11 @@
 * un intérêt à utiliser les extensions .client.js et .server.js pour les plugins? (https://fr.nuxtjs.org/docs/2.x/directory-structure/plugins#convention-pour-le-nommage-des-plugins)
 * DatesUtils.sortDates: est-ce qu'un sort standard ne suffirait pas?
 
+pour reproduire l'erreur lors des tests:
+
+    node_modules/jest/bin/jest.js --colors --verbose --runTestsByPath ./tests/unit/component/Ui/Xeditable/Text.spec.js --no-coverage
+
+
 ## Questions
 
 * classe Connection.ts: pqoi AxiosRequestConfig accepte le mot clé progress et pas showPogress?

+ 13 - 0
tests/unit/services/connection/constructUrl.spec.ts → tests/unit/services/connection/urlBuilder.spec.ts

@@ -76,5 +76,18 @@ describe('invoke()', () => {
         rootId: 1
       })).toEqual('/api/organizations/1/users')
     })
+
+    it('should return a concatenated url from a base and a tail', () => {
+      expect(UrlBuilder.concat('/api/', 'test')).toEqual('/api/test')
+    })
+    it('should return a concatenated url from a base and a any number of tails', () => {
+      expect(UrlBuilder.concat('/api/', 'test', 'foo', 'bar')).toEqual('/api/test/foo/bar')
+    })
+    it('the parts of the url shall be properly joined with forward slashes', () => {
+      expect(UrlBuilder.concat('/api', 'test/', '/foo')).toEqual('/api/test/foo')
+    })
+    it('shall return the base url if no tail is passed', () => {
+      expect(UrlBuilder.concat('/api')).toEqual('/api')
+    })
   })
 })

+ 2 - 2
tests/unit/services/profile/organizationProfile.spec.ts

@@ -192,11 +192,11 @@ describe('isManagerProduct()', () => {
 
 describe('isOrganizationWithChildren()', () => {
   it('should return false if the organization dont have children', () => {
-    expect(organizationProfile.isOrganizationWithChildren()).toBeFalsy()
+    expect(organizationProfile.hasChildren()).toBeFalsy()
   })
 
   it('should return true if the organization have children', () => {
     store.commit('organization/setHasChildren', true)
-    expect(organizationProfile.isOrganizationWithChildren()).toBeTruthy()
+    expect(organizationProfile.hasChildren()).toBeTruthy()
   })
 })