mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-13 07:01:00 -05:00
Minimum viable py-config default schema (#803)
* Minimium viable py-config default schema * Add packages and paths to default * Add in default for plugins * Remove tests for values no longer in the default config
This commit is contained in:
@@ -9,26 +9,19 @@ const allKeys = {
|
||||
};
|
||||
|
||||
const defaultConfig: AppConfig = {
|
||||
"name": "pyscript",
|
||||
"description": "default config",
|
||||
"version": "0.1",
|
||||
"schema_version": 1,
|
||||
"type": "app",
|
||||
"author_name": "anonymous coder",
|
||||
"author_email": "foo@bar.com",
|
||||
"license": "Apache",
|
||||
"autoclose_loader": true,
|
||||
"runtimes": [{
|
||||
"src": "https://cdn.jsdelivr.net/pyodide/v0.21.2/full/pyodide.js",
|
||||
"name": "pyodide-0.21.2",
|
||||
"lang": "python"
|
||||
}],
|
||||
"packages": [],
|
||||
"paths": [],
|
||||
"packages":[],
|
||||
"paths":[],
|
||||
"plugins": []
|
||||
}
|
||||
|
||||
|
||||
function addClasses(element: HTMLElement, classes: Array<string>) {
|
||||
for (const entry of classes) {
|
||||
element.classList.add(entry);
|
||||
|
||||
@@ -54,8 +54,6 @@ describe('PyConfig', () => {
|
||||
|
||||
it('should load the default config', () => {
|
||||
instance.connectedCallback();
|
||||
expect(instance.values.name).toBe('pyscript');
|
||||
expect(instance.values.author_email).toBe('foo@bar.com');
|
||||
expect(instance.values.pyscript?.time).not.toBeNull();
|
||||
// @ts-ignore
|
||||
expect(instance.values.runtimes[0].lang).toBe('python');
|
||||
@@ -68,8 +66,6 @@ describe('PyConfig', () => {
|
||||
// @ts-ignore
|
||||
expect(instance.values.runtimes[0].lang).toBe('covfefe');
|
||||
expect(instance.values.pyscript?.time).not.toBeNull();
|
||||
// version wasn't present in `inline config` but is still set due to merging with default
|
||||
expect(instance.values.version).toBe('0.1');
|
||||
});
|
||||
|
||||
it('should load the JSON config from src attribute', () => {
|
||||
@@ -81,8 +77,6 @@ describe('PyConfig', () => {
|
||||
expect(instance.values.pyscript?.time).not.toBeNull();
|
||||
// wonerful is an extra key supplied by the user and is unaffected by merging process
|
||||
expect(instance.values.wonerful).toBe('discgrace');
|
||||
// version wasn't present in `config from src` but is still set due to merging with default
|
||||
expect(instance.values.version).toBe('0.1');
|
||||
});
|
||||
|
||||
it('should load the JSON config from both inline and src', () => {
|
||||
@@ -109,8 +103,6 @@ describe('PyConfig', () => {
|
||||
// @ts-ignore
|
||||
expect(instance.values.runtimes[0].lang).toBe('covfefe');
|
||||
expect(instance.values.pyscript?.time).not.toBeNull();
|
||||
// version wasn't present in `inline config` but is still set due to merging with default
|
||||
expect(instance.values.version).toBe('0.1');
|
||||
expect(instance.values.wonerful).toBe('highjacked');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user