Skip to content

Commit

Permalink
Merge branch 'develop' into y24-088-tuberacks-epic
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/resources/api/v2/tube_rack_resource.rb
  • Loading branch information
andrewsparkes committed Feb 11, 2025
2 parents 85f486c + bf13288 commit 067132c
Show file tree
Hide file tree
Showing 102 changed files with 2,131 additions and 5,461 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
node-version-file: ".nvmrc"
# Establish a cache of js modules to improve performance
- name: Cache js
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
public/assets
Expand Down
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.52.0
14.53.0
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG CHIPSET=default
ARG RUBY_VERSION=3.3.6
ARG APPLE_PLATFORM=linux/amd64

# Use the correct base image depending on the architecture
# For Apple M1 Chip, run: docker build --build-arg CHIPSET=m1 .
FROM ruby:3.3.6-slim AS base_default
FROM --platform=linux/amd64 ruby:3.2.5-slim AS base_m1
FROM ruby:${RUBY_VERSION}-slim AS base_default
FROM --platform=${APPLE_PLATFORM} ruby:${RUBY_VERSION}-slim AS base_m1
FROM base_${CHIPSET} AS base

COPY .nvmrc /.nvmrc
Expand Down
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ group :default do
gem 'bootsnap'
gem 'rails', '~> 7.0.8'

# Previously part of ruby or rails, now separate gems
gem 'drb', '~> 2.2'
gem 'mutex_m', '~> 0.3.0'
gem 'syslog', '~> 0.2.0'

# Fix incompatibility with between Ruby 3.1 and Psych 4 (used for yaml)
# see https://stackoverflow.com/a/71192990
gem 'psych', '< 4'
Expand Down Expand Up @@ -79,6 +84,8 @@ group :default do
# - Load the gem from the branch
gem 'jsonapi-resources', github: 'sanger/jsonapi-resources', branch: 'develop'

gem 'csv', '~> 3.3' # Required by jsonapi-resources, previously part of ruby

# Wraps bunny with connection pooling and consumer process handling
gem 'sanger_warren'

Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ GEM
bigdecimal
rexml
crass (1.0.6)
csv (3.3.2)
cucumber (9.1.2)
builder (~> 3.2, >= 3.2.4)
cucumber-ci-environment (~> 9.2, >= 9.2.0)
Expand Down Expand Up @@ -205,6 +206,7 @@ GEM
diff-lcs (1.5.1)
docile (1.4.0)
domain_name (0.6.20240107)
drb (2.2.1)
dry-cli (1.0.0)
erubi (1.13.1)
exception_notification (4.5.0)
Expand Down Expand Up @@ -284,6 +286,7 @@ GEM
multi_test (1.1.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mutex_m (0.3.0)
mysql2 (0.5.6)
net-imap (0.5.5)
date
Expand Down Expand Up @@ -510,6 +513,7 @@ GEM
syntax_tree (>= 2.0.1)
sys-uname (1.2.3)
ffi (~> 1.1)
syslog (0.2.0)
temple (0.10.3)
test-prof (1.4.2)
thor (1.3.2)
Expand Down Expand Up @@ -578,11 +582,13 @@ DEPENDENCIES
carrierwave
caxlsx
configatron
csv (~> 3.3)
cucumber-rails
cucumber_github_formatter
daemons
database_cleaner
delayed_job_active_record
drb (~> 2.2)
exception_notification
factory_bot_rails
flipper (~> 0.25.0)
Expand All @@ -599,6 +605,7 @@ DEPENDENCIES
minitest-profiler
mocha
multi_json
mutex_m (~> 0.3.0)
mysql2
net-ldap
nokogiri
Expand Down Expand Up @@ -643,6 +650,7 @@ DEPENDENCIES
syntax_tree
syntax_tree-haml
syntax_tree-rbs
syslog (~> 0.2.0)
test-prof
timecop
traceroute
Expand Down
2 changes: 1 addition & 1 deletion app/api/io/study.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Io::Study < Core::Io::Base
study_metadata.commercially_available => commercially_available
study_metadata.data_release_study_type.name => data_release_sort_of_study
study_metadata.data_release_strategy => data_release_strategy
study_metadata.contaminated_human_data_access_group => contaminated_human_data_access_group
study_metadata.contaminated_human_data_access_group => contaminated_human_data_access_group
'
)
end
8 changes: 0 additions & 8 deletions app/controllers/studies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
@study.save!
current_user.grant_manager(@study)
User.find(params[:study_owner_id]).grant_owner(@study) if params[:study_owner_id].present?

# Process Study PolyMetadata options within the same transaction.
poly_metadata_params = params[:poly_metadata]
Study::PolyMetadataHandler.new(@study).process(poly_metadata_params) if poly_metadata_params
end

flash[:notice] = 'Your study has been created'
Expand Down Expand Up @@ -118,10 +114,6 @@ def update # rubocop:todo Metrics/AbcSize
end
end

# Process Study PolyMetadata options within the same transaction.
poly_metadata_params = params[:poly_metadata]
Study::PolyMetadataHandler.new(@study).process(poly_metadata_params) if poly_metadata_params

flash[:notice] = 'Your study has been updated'

redirect_to study_path(@study)
Expand Down
27 changes: 0 additions & 27 deletions app/frontend/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion app/frontend/plate-picks/components/HelpToggle.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import HelpToggle from "./HelpToggle.vue";

describe("HelpToggle.vue", () => {
Expand Down
1 change: 0 additions & 1 deletion app/frontend/plate-picks/components/PicksSection.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import PicksSection from "./PicksSection.vue";
import PicksSectionBatch from "./PicksSectionBatch.vue";
import defaultState from "../store/state";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import PicksSectionBatch from "./PicksSectionBatch.vue";
import PicksSectionBatchPick from "./PicksSectionBatchPick.vue";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import PicksSectionBatchPick from "./PicksSectionBatchPick.vue";
import defaultState from "../store/state";
import { storePlateWithPicks } from "../_test_examples_";
Expand Down Expand Up @@ -81,7 +80,7 @@ describe("PicksSectionBatchPick.vue", () => {
});

it("includes an editable short name", async () => {
const commit = jest.fn();
const commit = vi.fn();
const wrapper = shallowMount(PicksSectionBatchPick, {
propsData: {
name,
Expand Down
5 changes: 2 additions & 3 deletions app/frontend/plate-picks/components/PlatesSection.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import PlatesSection from "./PlatesSection.vue";
import PlatesSectionPlate from "./PlatesSectionPlate.vue";
import defaultState from "../store/state";
Expand Down Expand Up @@ -33,7 +32,7 @@ describe("PlatesSection.vue", () => {
it("triggers plate lookup", async () => {
const mockStore = {
state: defaultState(),
dispatch: jest.fn(),
dispatch: vi.fn(),
getters: { sortedScannedPlates: [] },
};
const wrapper = shallowMount(PlatesSection, {
Expand All @@ -52,7 +51,7 @@ describe("PlatesSection.vue", () => {
it("ignores empty input", async () => {
const mockStore = {
state: defaultState(),
dispatch: jest.fn(),
dispatch: vi.fn(),
getters: { sortedScannedPlates: [] },
};
const wrapper = shallowMount(PlatesSection, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import PlatesSectionPlate from "./PlatesSectionPlate.vue";
import defaultState from "../store/state";

Expand Down
26 changes: 13 additions & 13 deletions app/frontend/plate-picks/store/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe("actions.js", () => {
// mock commit
const plates = { 1: plateWithPicks() };
const state = { ...defaultState(), plates };
const dispatch = jest.fn();
const commit = jest.fn((_) => (state.scanStore[`_${exampleBarcode}`] = { barcode: exampleBarcode, id: 1 }));
const dispatch = vi.fn();
const commit = vi.fn((_) => (state.scanStore[`_${exampleBarcode}`] = { barcode: exampleBarcode, id: 1 }));
// apply action
await plateBarcodeScan({ commit, state, dispatch }, exampleBarcode);
// assert result
Expand All @@ -36,8 +36,8 @@ describe("actions.js", () => {
mirageServer.create("plate", plateWithoutPicks({ id: "1" }));
// mock commit
const state = defaultState();
const commit = jest.fn((_) => (state.scanStore[`_${exampleBarcode}`] = { barcode: exampleBarcode }));
const dispatch = jest.fn();
const commit = vi.fn((_) => (state.scanStore[`_${exampleBarcode}`] = { barcode: exampleBarcode }));
const dispatch = vi.fn();
// apply action
await plateBarcodeScan({ commit, state, dispatch }, exampleBarcode);
// assert result
Expand All @@ -53,8 +53,8 @@ describe("actions.js", () => {
mirageServer.create("plate", plateWithoutPicks({ id: "1", control: true }));
// mock commit
const state = defaultState();
const commit = jest.fn((_) => (state.scanStore[`_${exampleBarcode}`] = { barcode: exampleBarcode }));
const dispatch = jest.fn();
const commit = vi.fn((_) => (state.scanStore[`_${exampleBarcode}`] = { barcode: exampleBarcode }));
const dispatch = vi.fn();
// apply action
await plateBarcodeScan({ commit, state, dispatch }, exampleBarcode);
// assert result
Expand All @@ -73,10 +73,10 @@ describe("actions.js", () => {
// mock the console
// We don't *need* to do this, but it clutters the output and confuses
// actual failing tests
console.error = jest.fn();
console.error = vi.fn();
// mock commit
const state = defaultState();
const commit = jest.fn((_) => (state.scanStore["_BadPlate"] = { barcode: "BadPlate" }));
const commit = vi.fn((_) => (state.scanStore["_BadPlate"] = { barcode: "BadPlate" }));
// mock dependencies
// apply action
await plateBarcodeScan({ commit, state }, "BadPlate");
Expand All @@ -93,8 +93,8 @@ describe("actions.js", () => {
describe("fetchBatches", () => {
it("fetches each batch`", () => {
// mock commit
const commit = jest.fn();
const dispatch = jest.fn();
const commit = vi.fn();
const dispatch = vi.fn();
const state = defaultState();
// apply action
fetchBatches({ commit, dispatch, state }, { ids: [1, 2] });
Expand Down Expand Up @@ -132,8 +132,8 @@ describe("actions.js", () => {

// mock commit
const state = defaultState();
const commit = jest.fn().mockImplementationOnce((_) => (state.batches["b1"] = { id: "1" }));
const dispatch = jest.fn((_) => (state.pickCount += 1));
const commit = vi.fn().mockImplementationOnce((_) => (state.batches["b1"] = { id: "1" }));
const dispatch = vi.fn((_) => (state.pickCount += 1));

// apply action
await fetchBatch({ commit, dispatch, state }, { id: "1" });
Expand Down Expand Up @@ -170,7 +170,7 @@ describe("actions.js", () => {
// Set up initial state
const state = defaultState();
// apply action
const commit = jest.fn((_) => (state.pickCount += 1));
const commit = vi.fn((_) => (state.pickCount += 1));
const returned = nextPickId({ commit, state });
expect(commit).toHaveBeenCalledWith("incrementPick");
expect(returned).toBe(1);
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/plate-picks/store/mutations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("mutations.js", () => {
it("updates plates when they exist already", () => {
// Provided by the browser. We mock it. Currently just mock a string as we're not doing anything fancy
global.SpeechSynthesisUtterance = class extends String {};
global.speechSynthesis = { speak: jest.fn() };
global.speechSynthesis = { speak: vi.fn() };
// mock state
const state = defaultState();
state.plates = { 1: plateWithoutPicks({ id: 1 }) };
Expand All @@ -64,7 +64,7 @@ describe("mutations.js", () => {
it("updates picks when they exist already", () => {
// Provided by the browser. We mock it. Currently just mock a string as we're not doing anything fancy
global.SpeechSynthesisUtterance = class extends String {};
global.speechSynthesis = { speak: jest.fn() };
global.speechSynthesis = { speak: vi.fn() };
// mock state
const state = {
...defaultState(),
Expand Down
1 change: 0 additions & 1 deletion app/frontend/shared/components/BaseRadio.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils";
import "@testing-library/jest-dom";
import BaseRadio from "./BaseRadio.vue";

describe("BaseRadio.vue", () => {
Expand Down
1 change: 1 addition & 0 deletions app/frontend/shared/components/BaseRadio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default {
name: { type: String, required: true },
id: { type: String, required: true }, // Unique id essential for generating labels
},
emits: ["change"],
data: function () {
return {
value: this.selected,
Expand Down
3 changes: 3 additions & 0 deletions app/models/api/study_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,8 @@ def render_class
map_attribute_to_json_attribute(:data_deletion_period)
map_attribute_to_json_attribute(:contaminated_human_data_access_group)
with_association(:program, lookup_by: :id) { map_attribute_to_json_attribute(:name, 'programme') }
map_attribute_to_json_attribute(:ebi_library_strategy)
map_attribute_to_json_attribute(:ebi_library_source)
map_attribute_to_json_attribute(:ebi_library_selection)
end
end
Loading

0 comments on commit 067132c

Please sign in to comment.