Skip to content

Commit

Permalink
OCLOMRS-1031:Your Organizations Sources shows user-owned sources (#738)
Browse files Browse the repository at this point in the history
* OCLOMRS-1031:Your Organizations Sources shows user-owned sources

* fixes for failing test

* Use contains instead of equal to avoid the test error

Co-authored-by: hadijahkyampeire <hadijah315@gmail.com>
  • Loading branch information
suruchee and hadijahkyampeire committed Sep 8, 2021
1 parent ae39faa commit 036bcde
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ When(/the user selects the "(.+)" menu list item/, menuItem =>
Then("the subscription url should be copied", () => {
cy.window().then(win => {
win.navigator.clipboard.readText().then(text => {
assert.equal(
text,
`/users/${getUser()}/collections/${getDictionaryId()}/${getVersionId()}`
);
expect(text).to.contain(`/users/${getUser()}/collections/${getDictionaryId()}/${getVersionId()}/`)
});
});
});
2 changes: 2 additions & 0 deletions src/apps/dictionaries/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const api = {
params: {
limit,
page,
verbose: true,
q: buildPartialSearchQuery(q),
customValidationSchema: CUSTOM_VALIDATION_SCHEMA,
timestamp: new Date().getTime() // work around seemingly unhelpful caching
Expand All @@ -37,6 +38,7 @@ const api = {
params: {
limit,
page,
verbose: true,
q: buildPartialSearchQuery(q),
customValidationSchema: CUSTOM_VALIDATION_SCHEMA,
timestamp: new Date().getTime() // work around seemingly unhelpful caching
Expand Down
20 changes: 18 additions & 2 deletions src/apps/sources/__test__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ describe("api", () => {
const q: string = "";
const limit: number = 20;
const page: number = 1;
const response = await api.sources.retrieve.private(url, q, limit, page);
const verbose: boolean = true;
const response = await api.sources.retrieve.private(
url,
q,
limit,
page,
verbose
);

expect(authenticatedInstance.get).toHaveBeenCalledWith(url, {
params: {
limit: 20,
page: 1,
q: "",
verbose: true,
timestamp: expect.anything()
}
});
Expand All @@ -36,13 +44,21 @@ describe("api", () => {
const q: string = "";
const limit: number = 20;
const page: number = 1;
const response = await api.sources.retrieve.public(url, q, limit, page);
const verbose: boolean = true;
const response = await api.sources.retrieve.public(
url,
q,
limit,
page,
verbose
);

expect(unAuthenticatedInstance.get).toHaveBeenCalledWith(url, {
params: {
limit: 20,
page: 1,
q: "",
verbose: true,
timestamp: expect.anything()
}
});
Expand Down
18 changes: 16 additions & 2 deletions src/apps/sources/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,34 @@ const api = {
authenticatedInstance.put(sourceUrl, data),
sources: {
retrieve: {
private: (sourcesUrl: string, q: string = "", limit = 20, page = 1) =>
private: (
sourcesUrl: string,
q: string = "",
limit = 20,
page = 1,
verbose = true
) =>
authenticatedInstance.get(sourcesUrl, {
params: {
limit,
page,
verbose: true,
q: buildPartialSearchQuery(q),
timestamp: new Date().getTime() // work around seemingly unhelpful caching
}
}),
public: (sourcesUrl: string, q: string = "", limit = 20, page = 1) =>
public: (
sourcesUrl: string,
q: string = "",
limit = 20,
page = 1,
verbose = true
) =>
unAuthenticatedInstance.get(sourcesUrl, {
params: {
limit,
page,
verbose: true,
q: buildPartialSearchQuery(q),
timestamp: new Date().getTime() // work around seemingly unhelpful caching
}
Expand Down

0 comments on commit 036bcde

Please sign in to comment.