Skip to content

Commit 3f05913

Browse files
committed
chore: rename examples in tests
1 parent 09762d7 commit 3f05913

3 files changed

Lines changed: 43 additions & 43 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ export default defineNuxtConfig({
6868
formforgeClient: {
6969
baseURL: '/api/formforge/v1',
7070
scopedRoutes: {
71-
community: {
72-
prefix: 'communities/{community}',
71+
team: {
72+
prefix: 'teams/{team}',
7373
paramsFromRoute: {
74-
community: 'community'
74+
team: 'team'
7575
}
7676
}
7777
},
78-
defaultScope: 'community'
78+
defaultScope: 'team'
7979
}
8080
})
8181
```

test/http-base-url.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ describe('http baseURL placeholders', () => {
1919
}
2020

2121
const http = createFormForgeHttpAdapter({
22-
baseURL: 'http://localhost:8000/api/communities/{community}/formforge/v1',
22+
baseURL: 'http://localhost:8000/api/teams/{team}/formforge/v1',
2323
baseURLParams: () => ({
24-
community: 'acme'
24+
team: 'acme'
2525
}),
2626
fetch: fetchMock
2727
})
@@ -33,7 +33,7 @@ describe('http baseURL placeholders', () => {
3333

3434
await http<{ data: [] }>(request)
3535

36-
expect(requests[0]).toBe('http://localhost:8000/api/communities/acme/formforge/v1/categories')
36+
expect(requests[0]).toBe('http://localhost:8000/api/teams/acme/formforge/v1/categories')
3737
})
3838

3939
it('keeps unresolved placeholders untouched', async () => {
@@ -52,7 +52,7 @@ describe('http baseURL placeholders', () => {
5252
}
5353

5454
const http = createFormForgeHttpAdapter({
55-
baseURL: 'http://localhost:8000/api/communities/{community}/formforge/v1',
55+
baseURL: 'http://localhost:8000/api/teams/{team}/formforge/v1',
5656
fetch: fetchMock
5757
})
5858

@@ -61,6 +61,6 @@ describe('http baseURL placeholders', () => {
6161
method: 'GET'
6262
})
6363

64-
expect(requests[0]).toBe('http://localhost:8000/api/communities/{community}/formforge/v1/categories')
64+
expect(requests[0]).toBe('http://localhost:8000/api/teams/{team}/formforge/v1/categories')
6565
})
6666
})

test/scoped-routes.spec.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ describe('scoped routes', () => {
1010

1111
it('builds scoped URL with simple placeholder', () => {
1212
const path = resolveEndpointPath(undefined, '/forms', {}, {
13-
prefix: 'communities/{community}',
13+
prefix: 'teams/{team}',
1414
params: {
15-
community: 'acme'
15+
team: 'acme'
1616
}
1717
})
1818

19-
expect(path).toBe('/communities/acme/forms')
19+
expect(path).toBe('/teams/acme/forms')
2020
})
2121

2222
it('builds scoped URL with binding placeholder', () => {
2323
const path = resolveEndpointPath(undefined, '/forms', {}, {
24-
prefix: 'communities/{community:uuid}',
24+
prefix: 'teams/{team:uuid}',
2525
params: {
26-
community: 'acme'
26+
team: 'acme'
2727
}
2828
})
2929

30-
expect(path).toBe('/communities/acme/forms')
30+
expect(path).toBe('/teams/acme/forms')
3131
})
3232

3333
it('throws a clear error when scope param is missing', () => {
3434
expect(() => resolveEndpointPath(undefined, '/forms', {}, {
35-
prefix: 'communities/{community:uuid}',
35+
prefix: 'teams/{team:uuid}',
3636
params: {}
37-
})).toThrowError('Missing required scope param "community" for scope prefix "communities/{community:uuid}"')
37+
})).toThrowError('Missing required scope param "team" for scope prefix "teams/{team:uuid}"')
3838
})
3939

4040
it('uses default named scope when request scope is not provided', async () => {
@@ -55,23 +55,23 @@ describe('scoped routes', () => {
5555
const client = createFormForgeClient({
5656
baseURL: 'http://localhost:8000/api/formforge/v1',
5757
scopedRoutes: {
58-
community: {
59-
prefix: 'communities/{community}',
58+
team: {
59+
prefix: 'teams/{team}',
6060
paramsFromRoute: {
61-
community: 'community'
61+
team: 'team'
6262
}
6363
}
6464
},
65-
defaultScope: 'community',
65+
defaultScope: 'team',
6666
scopeParams: () => ({
67-
community: 'global'
67+
team: 'global'
6868
}),
6969
fetch: fetchMock
7070
})
7171

7272
await client.listForms(false)
7373

74-
expect(requests[0]).toBe('http://localhost:8000/api/formforge/v1/communities/global/forms?include_deleted=0')
74+
expect(requests[0]).toBe('http://localhost:8000/api/formforge/v1/teams/global/forms?include_deleted=0')
7575
})
7676

7777
it('supports scoped management routes when non-scoped route is unavailable', async () => {
@@ -89,7 +89,7 @@ describe('scoped routes', () => {
8989
})
9090
}
9191

92-
if (url.endsWith('/api/formforge/v1/communities/acme/forms?include_deleted=0')) {
92+
if (url.endsWith('/api/formforge/v1/teams/acme/forms?include_deleted=0')) {
9393
return new Response(JSON.stringify({
9494
data: []
9595
}), {
@@ -113,16 +113,16 @@ describe('scoped routes', () => {
113113
const client = createFormForgeClient({
114114
baseURL: 'http://localhost:8000/api/formforge/v1',
115115
scopedRoutes: {
116-
community: {
117-
prefix: 'communities/{community:uuid}',
116+
team: {
117+
prefix: 'teams/{team:uuid}',
118118
paramsFromRoute: {
119-
community: 'community'
119+
team: 'team'
120120
}
121121
}
122122
},
123-
defaultScope: 'community',
123+
defaultScope: 'team',
124124
scopeParams: () => ({
125-
community: 'acme'
125+
team: 'acme'
126126
}),
127127
fetch: fetchMock
128128
})
@@ -149,29 +149,29 @@ describe('scoped routes', () => {
149149
const client = createFormForgeClient({
150150
baseURL: 'http://localhost:8000/api/formforge/v1',
151151
scopedRoutes: {
152-
community: {
153-
prefix: 'communities/{community}',
152+
team: {
153+
prefix: 'teams/{team}',
154154
paramsFromRoute: {
155-
community: 'community'
155+
team: 'team'
156156
}
157157
},
158-
team: {
158+
teamOverride: {
159159
prefix: 'teams/{team}',
160160
paramsFromRoute: {
161-
team: 'team'
161+
team: 'teamOverride'
162162
}
163163
}
164164
},
165-
defaultScope: 'community',
165+
defaultScope: 'team',
166166
scopeParams: () => ({
167-
community: 'acme',
168-
team: 'core'
167+
team: 'acme',
168+
teamOverride: 'core'
169169
}),
170170
fetch: fetchMock
171171
})
172172

173173
await client.listForms(false, {
174-
scope: 'team'
174+
scope: 'teamOverride'
175175
})
176176

177177
expect(requests[0]).toBe('http://localhost:8000/api/formforge/v1/teams/core/forms?include_deleted=0')
@@ -190,18 +190,18 @@ describe('scoped routes', () => {
190190
const client = createFormForgeClient({
191191
baseURL: 'http://localhost:8000/api/formforge/v1',
192192
scopedRoutes: {
193-
community: {
194-
prefix: 'communities/{community:uuid}',
193+
team: {
194+
prefix: 'teams/{team:uuid}',
195195
paramsFromRoute: {
196-
community: 'community'
196+
team: 'team'
197197
}
198198
}
199199
},
200-
defaultScope: 'community',
200+
defaultScope: 'team',
201201
scopeParams: () => ({}),
202202
fetch: fetchMock
203203
})
204204

205-
await expect(client.listForms(false)).rejects.toThrowError('Missing scope param source "community" for named scope "community"')
205+
await expect(client.listForms(false)).rejects.toThrowError('Missing scope param source "team" for named scope "team"')
206206
})
207207
})

0 commit comments

Comments
 (0)