Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
- name: Install
run: bun install

- name: Run Linter
run: bun run lint

- name: Build with Vite
run: bun run build --base=/cellpack-client/pr-preview/pr-${PR_NUMBER}
env:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: run-tests
run-name: ✅ Checking '${{'#'}}${{github.ref_name}}' on branch '${{github.head_ref}}'
on: pull_request
jobs:
static-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install
run: bun install

- name: Run Linter
run: bun run lint
Comment on lines +17 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea to move lint tests here!


- name: Run Tests
# Run test even if the previous step(s) failed
if: success() || failure()
run: bun test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Front end website to interact with the cellPACK services running in AWS. This we
1. `bun run dev`
2. Navigate to http://localhost:5173/ in your browser

### Run Tests
1. `bun test`

### cellPACK Server
This client interacts with the cellPACK server, which consists of a variety of backend services hosted in AWS to run [cellPACK packings](https://github.com/mesoscope/cellpack). These AWS services include:
* **API Gateway**: cellPACK REST API providing this client with access to needed AWS resources for running and receiving data from cellPACK jobs. Includes the following endpoints:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"firebase": "^11.2.0",
Expand All @@ -27,6 +28,7 @@
"globals": "^15.11.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.10.0",
"vite": "^5.4.9"
"vite": "^5.4.9",
"vitest": "^3.2.4"
}
}
43 changes: 43 additions & 0 deletions src/test/recipeLoader.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { expect, test } from 'vitest';
import fs from 'fs';
import { isFirebaseRef, getFirebaseRecipe } from '../utils/recipeLoader';

test('isFirebaseRef detects Firebase references correctly', () => {
expect(isFirebaseRef('firebase:recipes/some_id')).toBe(true);
expect(isFirebaseRef('firebase:configs/some_id')).toBe(true);
expect(isFirebaseRef('not_a_firebase_ref')).toBe(false);
expect(isFirebaseRef('local/file/path')).toBe(false);
expect(isFirebaseRef(undefined)).toBe(false);
expect(isFirebaseRef(null)).toBe(false);
});

test('getFirebaseRecipe works as expected for ER_peroxisome_v_struct_gradient_370574', async () => {
const recipeId = 'ER_peroxisome_v_struct_gradient_370574';
const recipeString = await getFirebaseRecipe(recipeId);

expect(recipeString).toBeDefined();
expect(typeof recipeString).toBe('string');

const parsedRecipe = JSON.parse(recipeString);
expect(parsedRecipe.name).toBeDefined();
expect(parsedRecipe.version).toBeDefined();

const expectedRecipe = JSON.parse(fs.readFileSync('src/test/test-files/ER_peroxisome.json', 'utf8'));
expect(parsedRecipe).toEqual(expectedRecipe);
});

test('getFirebaseRecipe works as expected for one_sphere', async () => {
const recipeId = 'one_sphere_v_1.0.0';
const recipeString = await getFirebaseRecipe(recipeId);

expect(recipeString).toBeDefined();
expect(typeof recipeString).toBe('string');

const parsedRecipe = JSON.parse(recipeString);
expect(parsedRecipe.name).toBeDefined();
expect(parsedRecipe.version).toBeDefined();

const expectedRecipe = JSON.parse(fs.readFileSync('src/test/test-files/one_sphere.json', 'utf8'));
expect(parsedRecipe).toEqual(expectedRecipe);
});

177 changes: 177 additions & 0 deletions src/test/test-files/ER_peroxisome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"name": "ER_peroxisome",
"version": "struct_gradient_370574",
"format_version": "2.1",
"bounding_box": [
[
33.775,
35.375,
7.125
],
[
274.225,
208.625,
106.875
]
],
"grid_file_path": "https://cellpack-analysis-data.s3.us-west-2.amazonaws.com/demo/370574_grid.dat",
"composition": {
"membrane": {
"name": "membrane",
"molarity": null,
"regions": {
"interior": [
"nucleus",
"struct",
{
"object": "peroxisome",
"count": 121
}
]
},
"count": 1,
"priority": null,
"object": "membrane_mesh"
},
"nucleus": {
"name": "nucleus",
"priority": null,
"regions": {
"interior": []
},
"molarity": null,
"count": 1,
"object": "nucleus_mesh"
},
"struct": {
"name": "struct",
"regions": {
"interior": []
},
"molarity": null,
"count": 1,
"priority": null,
"object": "struct_mesh"
},
"bounding_area": {
"name": "bounding_area",
"priority": null,
"regions": {
"interior": [
"membrane"
]
},
"object": null,
"count": null,
"molarity": null
}
},
"objects": {
"membrane_mesh": {
"name": "membrane_mesh",
"representations": {
"mesh": {
"path": "https://cellpack-analysis-data.s3.us-west-2.amazonaws.com/demo",
"name": "mem_mesh_370574.obj",
"format": "obj"
},
"atomic": null,
"packing": null,
"active": null
},
"partners": {
"all_partners": []
},
"type": "mesh",
"color": [
0.75,
0.75,
0.75
]
},
"peroxisome": {
"name": "peroxisome",
"partners": {
"all_partners": []
},
"jitter_attempts": 300,
"radius": 2.37,
"gradient": "struct_gradient",
"representations": {
"mesh": null,
"active": null,
"packing": null,
"atomic": null
},
"packing_mode": "gradient",
"color": [
0,
1,
0
],
"type": "single_sphere"
},
"nucleus_mesh": {
"name": "nucleus_mesh",
"color": [
0.25,
0.25,
0.25
],
"partners": {
"all_partners": []
},
"representations": {
"mesh": {
"name": "nuc_mesh_370574.obj",
"path": "https://cellpack-analysis-data.s3.us-west-2.amazonaws.com/demo",
"format": "obj"
},
"atomic": null,
"active": null,
"packing": null
},
"type": "mesh"
},
"struct_mesh": {
"name": "struct_mesh",
"representations": {
"atomic": null,
"packing": null,
"active": null,
"mesh": {
"name": "struct_mesh_370574.obj",
"format": "obj",
"path": "https://cellpack-analysis-data.s3.us-west-2.amazonaws.com/demo"
}
},
"color": [
0.5,
0.5,
0.5
],
"type": "mesh",
"partners": {
"all_partners": []
}
}
},
"gradients": {
"struct_gradient": {
"name": "struct_gradient",
"invert": null,
"mode": "surface",
"pick_mode": "linear",
"weight_mode": "exponential",
"weight_mode_settings": {
"decay_length": 0.01
},
"reversed": false,
"description": "gradient based on distance from the surface of the struct mesh",
"mode_settings": {
"object": "struct",
"scale_to_next_surface": false
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "1.0.0",
"format_version": "2.0",
"format_version": "2.1",
"name": "one_sphere",
"bounding_box": [
[
Expand All @@ -16,6 +16,7 @@
],
"objects": {
"base": {
"name": "base",
"jitter_attempts": 10,
"orient_bias_range": [
-3.1415927,
Expand Down Expand Up @@ -43,6 +44,15 @@
0,
1
],
"partners": {
"all_partners": []
},
"representations": {
"mesh": null,
"atomic": null,
"packing": null,
"active": null
},
"available_regions": {
"interior": {},
"surface": {},
Expand All @@ -51,6 +61,7 @@
}
},
"sphere_25": {
"name": "sphere_25",
"type": "single_sphere",
"inherit": "base",
"color": [
Expand All @@ -59,15 +70,29 @@
0.5
],
"radius": 5,
"representations": {
"mesh": null,
"atomic": null,
"packing": null,
"active": null
},
"partners": {
"all_partners": []
},
"max_jitter": [
1,
1,
0
]
}
},
"gradients": {},
"composition": {
"space": {
"count": null,
"molarity": null,
"name": "space",
"object": null,
"regions": {
"interior": [
"A"
Expand All @@ -76,7 +101,10 @@
},
"A": {
"object": "sphere_25",
"count": 1
"molarity": null,
"name": "A",
"count": 1,
"regions": {}
}
}
}
Loading