Skip to content

Commit

Permalink
Merge branch 'master' into embedding-multi-view
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBabukov authored Dec 15, 2023
2 parents 0f3bc22 + 23bae23 commit 24ec48f
Show file tree
Hide file tree
Showing 34 changed files with 287 additions and 505 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import mockAPI, { generateDefaultMockAPIResponses, statusResponse } from '__test
import { loadSamples, updateSampleFileUpload } from 'redux/actions/samples';

import fake from '__test__/test-utils/constants';
import sampleFileType from 'utils/sampleFileType';

jest.mock('swr', () => () => ({
data: [
Expand Down Expand Up @@ -45,7 +46,7 @@ const sampleFileId = `${fake.SAMPLE_FILE_ID}`;
enableFetchMocks();

describe('UploadCell', () => {
const fileCategory = 'features.tsv.gz';
const fileCategory = sampleFileType.FEATURES_10_X;

let storeState = null;

Expand Down
39 changes: 19 additions & 20 deletions src/__test__/components/data-management/UploadDetailsModal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import '@testing-library/jest-dom';
import userEvent from '@testing-library/user-event';
import UploadDetailsModal from 'components/data-management/UploadDetailsModal';
import UploadStatus, { messageForStatus } from 'utils/upload/UploadStatus';
import UploadStatus from 'utils/upload/UploadStatus';

const mockOnDelete = jest.fn();
const mockOnCancel = jest.fn();
Expand All @@ -14,8 +14,7 @@ const mockOnRetry = jest.fn();

const defaultProps = {
visible: true,
file: {
name: 'example.txt',
data: {
size: 1024,
lastModified: new Date().toISOString(),
upload: {
Expand All @@ -41,9 +40,9 @@ describe('UploadDetailsModal', () => {

it('displays the modal with the correct title when uploaded', () => {
renderUploadDetailsModal({
file: {
...defaultProps.file,
upload: { ...defaultProps.file.upload, status: UploadStatus.UPLOADED },
data: {
...defaultProps.data,
upload: { ...defaultProps.data.upload, status: UploadStatus.UPLOADED },
},
});

Expand All @@ -52,8 +51,8 @@ describe('UploadDetailsModal', () => {

it('displays the modal with the correct title when file not found', () => {
renderUploadDetailsModal({
file: {
...defaultProps.file,
data: {
...defaultProps.data,
upload: { status: UploadStatus.FILE_NOT_FOUND },
},
});
Expand All @@ -62,9 +61,9 @@ describe('UploadDetailsModal', () => {

it('calls onRetry when the retry button is clicked', async () => {
renderUploadDetailsModal({
file: {
...defaultProps.file,
upload: { ...defaultProps.file.upload, status: UploadStatus.ERROR },
data: {
...defaultProps.data,
upload: { ...defaultProps.data.upload, status: UploadStatus.ERROR },
fileObject: [1, 2, 3, 4, 5, 6],
},
});
Expand All @@ -79,9 +78,9 @@ describe('UploadDetailsModal', () => {

it('calls onDownload when the download button is clicked', () => {
renderUploadDetailsModal({
file: {
...defaultProps.file,
upload: { ...defaultProps.file.upload, status: UploadStatus.UPLOADED },
data: {
...defaultProps.data,
upload: { ...defaultProps.data.upload, status: UploadStatus.UPLOADED },
},
});

Expand All @@ -94,9 +93,9 @@ describe('UploadDetailsModal', () => {
it('renders error message when there is an upload error', () => {
const status = UploadStatus.UPLOAD_ERROR;
renderUploadDetailsModal({
file: {
...defaultProps.file,
upload: { ...defaultProps.file.upload, status },
data: {
...defaultProps.data,
upload: { ...defaultProps.data.upload, status },
},
});

Expand All @@ -106,9 +105,9 @@ describe('UploadDetailsModal', () => {
it('Deleting the file calls onDelete', () => {
const status = UploadStatus.UPLOADED;
renderUploadDetailsModal({
file: {
...defaultProps.file,
upload: { ...defaultProps.file.upload, status },
data: {
...defaultProps.data,
upload: { ...defaultProps.data.upload, status },
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,35 +328,24 @@ exports[`switch experiment Then updates the experiment info 1`] = `
"test9188-d682-test-mock-cb6d644cmock-0": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "testae48e318dab9a1bd0bexperiment-0",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": 1000,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand All @@ -372,35 +361,24 @@ exports[`switch experiment Then updates the experiment info 1`] = `
"test9188-d682-test-mock-cb6d644cmock-1": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "testae48e318dab9a1bd0bexperiment-0",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": 1000,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand All @@ -416,35 +394,24 @@ exports[`switch experiment Then updates the experiment info 1`] = `
"test9188-d682-test-mock-cb6d644cmock-2": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "testae48e318dab9a1bd0bexperiment-0",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": 1000,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand Down Expand Up @@ -792,35 +759,24 @@ exports[`switch experiment switches the experiment to its initial values 1`] =
"test9188-d682-test-mock-cb6d644cmock-0": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "testae48e318dab9a1bd0bexperiment-0",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": 1000,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand All @@ -836,35 +792,24 @@ exports[`switch experiment switches the experiment to its initial values 1`] =
"test9188-d682-test-mock-cb6d644cmock-1": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "testae48e318dab9a1bd0bexperiment-0",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": 1000,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand All @@ -880,35 +825,24 @@ exports[`switch experiment switches the experiment to its initial values 1`] =
"test9188-d682-test-mock-cb6d644cmock-2": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "testae48e318dab9a1bd0bexperiment-0",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": 100,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": 1000,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,24 @@ exports[`loadSample action Works correctly 1`] = `
"e03ef6ea-5014-4e57-aecd-59964ac9172c": {
"createdDate": "2021-12-07 17:36:27.773+00",
"experimentId": "1234",
"fileNames": [
"matrix.mtx.gz",
"barcodes.tsv.gz",
"features.tsv.gz",
],
"files": {
"barcodes.tsv.gz": {
"name": "barcodes.tsv.gz",
"barcodes10x": {
"size": undefined,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"features.tsv.gz": {
"name": "features.tsv.gz",
"features10x": {
"size": undefined,
"upload": {
"status": "uploaded",
},
"valid": true,
},
"matrix.mtx.gz": {
"name": "matrix.mtx.gz",
"matrix10x": {
"size": undefined,
"upload": {
"status": "uploaded",
},
"valid": true,
},
},
"lastModified": "2021-12-07 17:38:42.036+00",
Expand Down
Loading

0 comments on commit 24ec48f

Please sign in to comment.