@opencloning/opencloning-elabftw 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @opencloning/opencloning-elabftw
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`0b2a21d`](https://github.com/OpenCloning/OpenCloning_frontend/commit/0b2a21dde79f5539579bee39f0de49b01cd6c10c)]:
|
|
8
|
+
- @opencloning/utils@2.1.1
|
|
9
|
+
- @opencloning/ui@2.1.1
|
|
10
|
+
|
|
11
|
+
## 2.1.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`c8c46d4`](https://github.com/OpenCloning/OpenCloning_frontend/commit/c8c46d4dc36cb8741d1bd89816c7ca82b89996b3)]:
|
|
16
|
+
- @opencloning/ui@2.1.0
|
|
17
|
+
- @opencloning/utils@2.1.0
|
|
18
|
+
|
|
3
19
|
## 2.0.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "MIT",
|
|
3
3
|
"name": "@opencloning/opencloning-elabftw",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@mui/icons-material": "^5.18.0",
|
|
17
17
|
"@mui/material": "^5.18.0",
|
|
18
|
-
"@opencloning/ui": "2.
|
|
19
|
-
"@opencloning/utils": "2.
|
|
18
|
+
"@opencloning/ui": "2.1.1",
|
|
19
|
+
"@opencloning/utils": "2.1.1",
|
|
20
20
|
"axios": "^1.20.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -5,7 +5,7 @@ import { eLabFTWHttpClient } from './common';
|
|
|
5
5
|
describe('<ELabFTWCategorySelect />', () => {
|
|
6
6
|
it('Allows to retry if the request fails', () => {
|
|
7
7
|
cy.stub(eLabFTWHttpClient, 'get').withArgs('/api/v2/info', { headers: { Authorization: 'test-read-key' } }).as('eLabFTWHttpClientSpy');
|
|
8
|
-
cy.mount(<ELabFTWCategorySelect fullWidth />);
|
|
8
|
+
cy.mount(<ELabFTWCategorySelect mode="resource_type" fullWidth />);
|
|
9
9
|
cy.get('@eLabFTWHttpClientSpy.all').should('have.callCount', 1);
|
|
10
10
|
cy.get('button').contains('Retry').click();
|
|
11
11
|
cy.get('@eLabFTWHttpClientSpy.all').should('have.callCount', 2);
|
|
@@ -13,7 +13,7 @@ describe('<ELabFTWCategorySelect />', () => {
|
|
|
13
13
|
it('shows the right options', () => {
|
|
14
14
|
const setCategorySpy = cy.spy().as('setCategorySpy');
|
|
15
15
|
cy.stub(eLabFTWHttpClient, 'get')
|
|
16
|
-
.withArgs('/api/v2/
|
|
16
|
+
.withArgs('/api/v2/teams/current/resources_categories', { headers: { Authorization: 'test-read-key' }, params: {} }).resolves({
|
|
17
17
|
data: [
|
|
18
18
|
{ id: 1, title: 'Category 1' },
|
|
19
19
|
{ id: 2, title: 'Category 2' },
|
|
@@ -24,7 +24,7 @@ describe('<ELabFTWCategorySelect />', () => {
|
|
|
24
24
|
elabftw_version_int: 50200,
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
|
-
cy.mount(<ELabFTWCategorySelect fullWidth setCategory={setCategorySpy} />);
|
|
27
|
+
cy.mount(<ELabFTWCategorySelect mode="resource_type" fullWidth setCategory={setCategorySpy} />);
|
|
28
28
|
cy.get('.MuiAutocomplete-root').click();
|
|
29
29
|
cy.get('li').contains('Category 1').should('exist');
|
|
30
30
|
cy.get('li').contains('Category 2').should('exist');
|
|
@@ -32,10 +32,32 @@ describe('<ELabFTWCategorySelect />', () => {
|
|
|
32
32
|
cy.get('@setCategorySpy').should('have.been.calledWith', { id: 1, title: 'Category 1' });
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it('
|
|
36
|
-
cy.
|
|
35
|
+
it('uses the items_types endpoint in template mode', () => {
|
|
36
|
+
const setCategorySpy = cy.spy().as('setCategorySpy');
|
|
37
37
|
cy.stub(eLabFTWHttpClient, 'get')
|
|
38
38
|
.withArgs('/api/v2/items_types', { headers: { Authorization: 'test-read-key' }, params: {} }).resolves({
|
|
39
|
+
data: [
|
|
40
|
+
{ id: 1, title: 'Template 1' },
|
|
41
|
+
{ id: 2, title: 'Template 2' },
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
.withArgs('/api/v2/info', { headers: { Authorization: 'test-read-key' } }).resolves({
|
|
45
|
+
data: {
|
|
46
|
+
elabftw_version_int: 50300,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
cy.mount(<ELabFTWCategorySelect mode="template" fullWidth setCategory={setCategorySpy} />);
|
|
50
|
+
cy.get('.MuiAutocomplete-root').click();
|
|
51
|
+
cy.get('li').contains('Template 1').should('exist');
|
|
52
|
+
cy.get('li').contains('Template 2').should('exist');
|
|
53
|
+
cy.get('li').contains('Template 1').click();
|
|
54
|
+
cy.get('@setCategorySpy').should('have.been.calledWith', { id: 1, title: 'Template 1' });
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('shows empty options if no categories are found', () => {
|
|
58
|
+
cy.mount(<ELabFTWCategorySelect mode="resource_type" fullWidth />);
|
|
59
|
+
cy.stub(eLabFTWHttpClient, 'get')
|
|
60
|
+
.withArgs('/api/v2/teams/current/resources_categories', { headers: { Authorization: 'test-read-key' }, params: {} }).resolves({
|
|
39
61
|
data: [],
|
|
40
62
|
})
|
|
41
63
|
.withArgs('/api/v2/info', { headers: { Authorization: 'test-read-key' } }).resolves({
|
|
@@ -48,7 +70,7 @@ describe('<ELabFTWCategorySelect />', () => {
|
|
|
48
70
|
});
|
|
49
71
|
|
|
50
72
|
it('shows an error message if the request fails and can retry', () => {
|
|
51
|
-
cy.mount(<ELabFTWCategorySelect fullWidth />);
|
|
73
|
+
cy.mount(<ELabFTWCategorySelect mode="resource_type" fullWidth />);
|
|
52
74
|
cy.stub(eLabFTWHttpClient, 'get')
|
|
53
75
|
.withArgs('/api/v2/info', { headers: { Authorization: 'test-read-key' } })
|
|
54
76
|
.resolves({
|
|
@@ -56,7 +78,7 @@ describe('<ELabFTWCategorySelect />', () => {
|
|
|
56
78
|
elabftw_version_int: 50300,
|
|
57
79
|
},
|
|
58
80
|
}).as('eLabFTWHttpClientSpyInfo')
|
|
59
|
-
.withArgs('/api/v2/
|
|
81
|
+
.withArgs('/api/v2/teams/current/resources_categories', { headers: { Authorization: 'test-read-key' }, params: {} })
|
|
60
82
|
.rejects(new Error('Connection error')).as('eLabFTWHttpClientSpy');
|
|
61
83
|
cy.get('.MuiAlert-message').should('contain', 'Could not retrieve categories');
|
|
62
84
|
// Clicking the retry button makes the request again
|
|
@@ -11,7 +11,7 @@ describe('<GetPrimerComponent />', () => {
|
|
|
11
11
|
|
|
12
12
|
// Stub both endpoints in a single stub
|
|
13
13
|
cy.stub(eLabFTWHttpClient, 'get').callsFake((url) => {
|
|
14
|
-
if (url === '/api/v2/
|
|
14
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
15
15
|
return Promise.resolve({
|
|
16
16
|
data: [
|
|
17
17
|
{ id: PRIMER_CATEGORY_ID, title: 'Primers' },
|
|
@@ -42,7 +42,7 @@ describe('<GetPrimerComponent />', () => {
|
|
|
42
42
|
|
|
43
43
|
// Stub both endpoints in a single stub
|
|
44
44
|
cy.stub(eLabFTWHttpClient, 'get').callsFake((url, config) => {
|
|
45
|
-
if (url === '/api/v2/
|
|
45
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
46
46
|
return Promise.resolve({
|
|
47
47
|
data: [{ id: PRIMER_CATEGORY_ID, title: 'Primers' }],
|
|
48
48
|
});
|
|
@@ -89,7 +89,7 @@ describe('<GetPrimerComponent />', () => {
|
|
|
89
89
|
|
|
90
90
|
// Stub both endpoints in a single stub
|
|
91
91
|
cy.stub(eLabFTWHttpClient, 'get').callsFake((url, config) => {
|
|
92
|
-
if (url === '/api/v2/
|
|
92
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
93
93
|
return Promise.resolve({
|
|
94
94
|
data: [{ id: PRIMER_CATEGORY_ID, title: 'Primers' }],
|
|
95
95
|
});
|
|
@@ -137,7 +137,7 @@ describe('<GetPrimerComponent />', () => {
|
|
|
137
137
|
const setErrorSpy = cy.spy().as('setErrorSpy');
|
|
138
138
|
|
|
139
139
|
cy.stub(eLabFTWHttpClient, 'get').callsFake((url) => {
|
|
140
|
-
if (url === '/api/v2/
|
|
140
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
141
141
|
return Promise.resolve({
|
|
142
142
|
data: [{ id: PRIMER_CATEGORY_ID, title: 'Primers' }],
|
|
143
143
|
});
|
|
@@ -172,7 +172,7 @@ describe('<GetPrimerComponent />', () => {
|
|
|
172
172
|
|
|
173
173
|
// Stub both endpoints in a single stub
|
|
174
174
|
cy.stub(eLabFTWHttpClient, 'get').callsFake((url, config) => {
|
|
175
|
-
if (url === '/api/v2/
|
|
175
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
176
176
|
return Promise.resolve({
|
|
177
177
|
data: [{ id: PRIMER_CATEGORY_ID, title: 'Primers' }],
|
|
178
178
|
});
|
|
@@ -218,7 +218,7 @@ describe('<GetPrimerComponent />', () => {
|
|
|
218
218
|
let firstCallCategory = true;
|
|
219
219
|
let firstCallPrimer = true;
|
|
220
220
|
cy.stub(eLabFTWHttpClient, 'get').callsFake((url, config) => {
|
|
221
|
-
if (url === '/api/v2/
|
|
221
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
222
222
|
if (firstCallCategory) {
|
|
223
223
|
firstCallCategory = false;
|
|
224
224
|
return Promise.reject(new Error('Network error'));
|
|
@@ -14,7 +14,7 @@ const OTHER_FILE_ID = newUniqueId();
|
|
|
14
14
|
const TEST_FILE_CONTENT = 'test content';
|
|
15
15
|
|
|
16
16
|
const commonStubHandler = (url, config) => {
|
|
17
|
-
if (url === '/api/v2/
|
|
17
|
+
if (url === '/api/v2/teams/current/resources_categories') {
|
|
18
18
|
return Promise.resolve({
|
|
19
19
|
data: [
|
|
20
20
|
{ id: SEQUENCE_CATEGORY_ID, title: 'Sequences' },
|