Skip to content

Commit 478bf85

Browse files
committed
fix: org not owner
1 parent 5957e1a commit 478bf85

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export async function resolveConfig(ctx, tenant, overrides = {}) {
6060
suffix,
6161
);
6262

63-
const [owner = '', repo = ''] = tenant.split('--');
63+
const [org = '', repo = ''] = tenant.split('--');
6464
// merge configs
6565
/** @type {Config} */
6666
const resolved = {
@@ -80,7 +80,7 @@ export async function resolveConfig(ctx, tenant, overrides = {}) {
8080
headers: confMap.base?.headers ?? {},
8181
params: {},
8282
}),
83-
owner,
83+
org,
8484
repo,
8585
...overrides,
8686
};

test/config.test.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const TEST_CONTEXT = (path, configMap) => ({
2525
},
2626
},
2727
log: console,
28-
url: new URL(`https://www.example.com/owner--repo/content${path}`),
28+
url: new URL(`https://www.example.com/org--repo/content${path}`),
2929
info: {
3030
method: 'GET',
3131
headers: {},
@@ -35,7 +35,7 @@ const TEST_CONTEXT = (path, configMap) => ({
3535
describe('config tests', () => {
3636
it('should extract path params', async () => {
3737
const tenantConfigs = {
38-
'owner--repo': {
38+
'org--repo': {
3939
base: {
4040
apiKey: 'bad',
4141
},
@@ -47,21 +47,21 @@ describe('config tests', () => {
4747
};
4848
const config = await resolveConfig(
4949
TEST_CONTEXT('/us/p/my-url-key/some-sku', tenantConfigs),
50-
'owner--repo',
50+
'org--repo',
5151
);
5252
assert.deepStrictEqual(config, {
5353
apiKey: 'good',
5454
params: { urlkey: 'my-url-key', sku: 'some-sku' },
5555
headers: {},
5656
pageType: 'product',
57-
owner: 'owner',
57+
org: 'org',
5858
repo: 'repo',
5959
});
6060
});
6161

6262
it('should combine headers objects', async () => {
6363
const tenantConfigs = {
64-
'owner--repo': {
64+
'org--repo': {
6565
base: {
6666
apiKey: 'bad',
6767
headers: {
@@ -81,21 +81,21 @@ describe('config tests', () => {
8181
};
8282
const config = await resolveConfig(
8383
TEST_CONTEXT('/us/p/my-url-key/some-sku', tenantConfigs),
84-
'owner--repo',
84+
'org--repo',
8585
);
8686
assert.deepStrictEqual(config, {
8787
apiKey: 'good',
8888
params: { urlkey: 'my-url-key', sku: 'some-sku' },
8989
headers: { foo: '2', baz: '1', bar: '2' },
9090
pageType: 'product',
91-
owner: 'owner',
91+
org: 'org',
9292
repo: 'repo',
9393
});
9494
});
9595

9696
it('should allow wildcard path segments', async () => {
9797
const tenantConfigs = {
98-
'owner--repo': {
98+
'org--repo': {
9999
base: {
100100
apiKey: 'bad',
101101
},
@@ -107,21 +107,21 @@ describe('config tests', () => {
107107
};
108108
const config = await resolveConfig(
109109
TEST_CONTEXT('/us/p/something-here/some-sku', tenantConfigs),
110-
'owner--repo',
110+
'org--repo',
111111
);
112112
assert.deepStrictEqual(config, {
113113
apiKey: 'good',
114114
params: { sku: 'some-sku' },
115115
headers: {},
116116
pageType: 'product',
117-
owner: 'owner',
117+
org: 'org',
118118
repo: 'repo',
119119
});
120120
});
121121

122122
it('should allow overrides', async () => {
123123
const tenantConfigs = {
124-
'owner--repo': {
124+
'org--repo': {
125125
base: {
126126
apiKey: 'bad1',
127127
},
@@ -133,15 +133,15 @@ describe('config tests', () => {
133133
};
134134
const config = await resolveConfig(
135135
TEST_CONTEXT('/us/p/some-sku', tenantConfigs),
136-
'owner--repo',
136+
'org--repo',
137137
{ apiKey: 'good' },
138138
);
139139
assert.deepStrictEqual(config, {
140140
apiKey: 'good',
141141
params: { sku: 'some-sku' },
142142
pageType: 'product',
143143
headers: {},
144-
owner: 'owner',
144+
org: 'org',
145145
repo: 'repo',
146146
});
147147
});

0 commit comments

Comments
 (0)