No more empty outputs from modeling API (#3931)

* WIP: No more empty outputs from modeling API

Part of https://github.com/KittyCAD/modeling-api/issues/518

* Remove unused import

* Keep Empty in the API

* Fix TS type error due to upgrade to ts_rs 10.0.0

* Fix warning about unused use

* Fix more type errors from ts_rs upgrade

* De-flake settings override desktop test

* Update export test file sizes

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Frank Noirot <frank@kittycad.io>
This commit is contained in:
Adam Chalmers
2024-09-20 16:28:52 -05:00
committed by GitHub
parent 93d9b10e11
commit 5a0a635995
8 changed files with 14 additions and 19 deletions

View File

@ -104,7 +104,7 @@ test(
},
{ timeout: 15_000 }
)
.toBe(477481)
.toBe(482669)
// clean up output.gltf
await fsp.rm('output.gltf')

View File

@ -203,7 +203,7 @@ test.describe('Can export from electron app', () => {
},
{ timeout: 15_000 }
)
.toBe(477481)
.toBe(482669)
// clean up output.gltf
await fsp.rm('output.gltf')

View File

@ -277,8 +277,6 @@ test.describe('Testing settings', () => {
await page.setViewportSize({ width: 1200, height: 500 })
page.on('console', console.log)
// Selectors and constants
const userThemeColor = '120'
const projectThemeColor = '50'
@ -292,7 +290,6 @@ test.describe('Testing settings', () => {
const projectLink = page.getByText('bracket')
const logoLink = page.getByTestId('app-logo')
// Open the app and set the user theme color
await test.step('Set user theme color on home', async () => {
await expect(settingsOpenButton).toBeVisible()
await settingsOpenButton.click()
@ -311,13 +308,15 @@ test.describe('Testing settings', () => {
await expect(projectSettingsTab).toBeChecked()
await themeColorSetting.fill(projectThemeColor)
await expect(logoLink).toHaveCSS('--primary-hue', projectThemeColor)
await settingsCloseButton.click()
})
await test.step('Refresh the application and see project setting applied', async () => {
// Make sure we're done navigating before we reload
await expect(settingsCloseButton).not.toBeVisible()
await page.reload({ waitUntil: 'domcontentloaded' })
await expect(logoLink).toHaveCSS('--primary-hue', projectThemeColor)
await settingsCloseButton.click()
})
await test.step(`Navigate back to the home view and see user setting applied`, async () => {

View File

@ -1766,17 +1766,17 @@ const key = 'c'`
const ast = parse(code)
if (err(ast)) throw ast
const { nonCodeMeta } = ast
expect(nonCodeMeta.nonCodeNodes[0][0]).toEqual(nonCodeMetaInstance)
expect(nonCodeMeta.nonCodeNodes[0]?.[0]).toEqual(nonCodeMetaInstance)
// extra whitespace won't change it's position (0) or value (NB the start end would have changed though)
const codeWithExtraStartWhitespace = '\n\n\n' + code
const ast2 = parse(codeWithExtraStartWhitespace)
if (err(ast2)) throw ast2
const { nonCodeMeta: nonCodeMeta2 } = ast2
expect(nonCodeMeta2.nonCodeNodes[0][0].value).toStrictEqual(
expect(nonCodeMeta2.nonCodeNodes[0]?.[0].value).toStrictEqual(
nonCodeMetaInstance.value
)
expect(nonCodeMeta2.nonCodeNodes[0][0].start).not.toBe(
expect(nonCodeMeta2.nonCodeNodes[0]?.[0].start).not.toBe(
nonCodeMetaInstance.start
)
})

View File

@ -1527,8 +1527,7 @@ dependencies = [
[[package]]
name = "kittycad-modeling-cmds"
version = "0.2.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee900033a5804ca2354f0760478e851a0ab04d32b38a9117d0bd4f87a8867110"
source = "git+https://github.com/KittyCAD/modeling-api?branch=achalmers/no-more-empty#2611f6f93b20b4efc701fd008ee3ccab8c447907"
dependencies = [
"anyhow",
"chrono",
@ -1552,8 +1551,7 @@ dependencies = [
[[package]]
name = "kittycad-modeling-cmds-macros"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0cdc505a33bfffb87c317435ec41ced8f73474217cf30db685e479bf289757e"
source = "git+https://github.com/KittyCAD/modeling-api?branch=achalmers/no-more-empty#2611f6f93b20b4efc701fd008ee3ccab8c447907"
dependencies = [
"proc-macro2",
"quote",

View File

@ -73,7 +73,7 @@ members = [
http = "0.2.12"
kittycad = { version = "0.3.20", default-features = false, features = ["js", "requests"] }
kittycad-modeling-session = "0.1.4"
kittycad-modeling-cmds = { version = "0.2.59", features = ["websocket"] }
kittycad-modeling-cmds = { git = "https://github.com/KittyCAD/modeling-api", branch="achalmers/no-more-empty", features = ["websocket"] }
[[test]]
name = "executor"

View File

@ -40,7 +40,8 @@ pub struct StdLibFnData {
/// This struct defines a single argument to a stdlib function.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)]
#[ts(export)]
// There's a bug in ts_rs where this isn't correctly imported by StdLibFnData.
#[ts(export_to = "StdLibFnData.ts")]
#[serde(rename_all = "camelCase")]
pub struct StdLibFnArg {
/// The name of the argument.

View File

@ -1,9 +1,6 @@
//! Functions for setting up our WebSocket and WebRTC connections for communications with the
//! engine.
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};
use std::sync::{Arc, Mutex};
use anyhow::Result;
use indexmap::IndexMap;