Skip to content

Commit

Permalink
Modify options tests to contain base-path
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed May 30, 2021
1 parent 31e21f7 commit 4dec03a
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 48 deletions.
2 changes: 2 additions & 0 deletions packages/kit/src/core/dev/index.js
Expand Up @@ -86,6 +86,8 @@ class Watcher extends EventEmitter {
...user_config,
configFile: false,
root: this.cwd,
// Adding this fixes some tests but breaks others.
// base: `${this.config.kit.paths.base}/`,
resolve: {
...user_config.resolve,
alias: {
Expand Down
2 changes: 2 additions & 0 deletions packages/kit/src/core/start/index.js
Expand Up @@ -40,6 +40,8 @@ export async function start({ port, host, config, https: use_https = false, cwd
});

app.init({
// This didn't have any impact
// paths: config.kit.paths,
paths: {
base: '',
assets: '/.'
Expand Down
12 changes: 0 additions & 12 deletions packages/kit/test/apps/aa-routing/src/app.html

This file was deleted.

8 changes: 0 additions & 8 deletions packages/kit/test/apps/aa-routing/src/routes/__layout.svelte

This file was deleted.

8 changes: 0 additions & 8 deletions packages/kit/test/apps/aa-routing/src/routes/valid/_tests.js

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions packages/kit/test/apps/aa-routing/svelte.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/kit/test/apps/options/source/pages/_tests.js
Expand Up @@ -2,7 +2,7 @@ import * as assert from 'uvu/assert';

/** @type {import('test').TestMaker} */
export default function (test, is_dev) {
test('serves /', '/', async ({ page, js }) => {
test('serves /', '/base-path/', async ({ page, js }) => {
assert.equal(await page.textContent('h1'), 'I am in the template');
assert.equal(await page.textContent('h2'), "We're on index.svelte");
assert.equal(
Expand Down
Expand Up @@ -2,7 +2,7 @@ import * as assert from 'uvu/assert';

/** @type {import('test').TestMaker} */
export default function (test) {
test('enables floc', '/headers/', async ({ response }) => {
test('enables floc', '/base-path/headers/', async ({ response }) => {
const headers = response.headers();
assert.equal(headers['permissions-policy'], undefined);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/apps/options/source/pages/host/_tests.js
Expand Up @@ -2,7 +2,7 @@ import * as assert from 'uvu/assert';

/** @type {import('test').TestMaker} */
export default function (test) {
test('sets host', '/host/', async ({ page }) => {
test('sets host', '/base-path/host/', async ({ page }) => {
assert.equal(await page.textContent('[data-source="load"]'), 'example.com');
assert.equal(await page.textContent('[data-source="store"]'), 'example.com');
assert.equal(await page.textContent('[data-source="endpoint"]'), 'example.com');
Expand Down
10 changes: 5 additions & 5 deletions packages/kit/test/apps/options/source/pages/slash/_tests.js
Expand Up @@ -2,12 +2,12 @@ import * as assert from 'uvu/assert';

/** @type {import('test').TestMaker} */
export default function (test) {
test('adds trailing slash', '/slash', async ({ base, page, clicknav }) => {
assert.equal(page.url(), `${base}/slash/`);
assert.equal(await page.textContent('h2'), '/slash/');
test('adds trailing slash', '/base-path/slash', async ({ base, page, clicknav }) => {
assert.equal(page.url(), `${base}/base-path/slash/`);
assert.equal(await page.textContent('h2'), '/base-path/slash/');

await clicknav('[href="/slash/child"]');
assert.equal(page.url(), `${base}/slash/child/`);
assert.equal(await page.textContent('h2'), '/slash/child/');
assert.equal(page.url(), `${base}/base-path/slash/child/`);
assert.equal(await page.textContent('h2'), '/base-path/slash/child/');
});
}
3 changes: 3 additions & 0 deletions packages/kit/test/apps/options/svelte.config.js
Expand Up @@ -7,6 +7,9 @@ const config = {
routes: 'source/pages',
template: 'source/template.html'
},
paths: {
base: '/base-path'
},
appDir: '_wheee',
floc: true,
target: '#content-goes-here',
Expand Down

0 comments on commit 4dec03a

Please sign in to comment.