-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(webAPI): Added tests for optional EndUserId param on ServiceOwn…
…er Get endpoints (#1240) <!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> ## Related Issue(s) - #515 ## Verification - [x] **Your** code builds clean without any errors or warnings - [x] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new test cases for dialog creation and retrieval, including scenarios for valid and invalid `endUserId`. - Enhanced dialog search functionality with filtering based on `endUserId` and service resource. - **Bug Fixes** - Improved validation of response status and structure in dialog-related tests. - **Tests** - Expanded test coverage for dialog creation, retrieval, patching, and purging scenarios, ensuring comprehensive testing of dialog functionalities. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Ole Jørgen Skogstad <skogstad@softis.net>
- Loading branch information
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
describe, | ||
expect, | ||
expectStatusFor, | ||
getSO, | ||
postSO | ||
} from '../../common/testimports.js' | ||
import {default as dialogToInsert} from './testdata/01-create-dialog.js'; | ||
import { getDefaultEnduserSsn } from "../../common/token.js"; | ||
|
||
export default function () { | ||
|
||
let dialogId = null; | ||
let endUserId = "urn:altinn:person:identifier-no:" + getDefaultEnduserSsn(); | ||
let invalidEndUserId = "urn:altinn:person:identifier-no:08895699684"; | ||
|
||
describe('Perform dialog create', () => { | ||
let r = postSO('dialogs', dialogToInsert()); | ||
expectStatusFor(r).to.equal(201); | ||
expect(r, 'response').to.have.validJsonBody(); | ||
|
||
dialogId = r.json(); | ||
}); | ||
|
||
describe('Perform dialog get with endUserId', () => { | ||
let r = getSO('dialogs/' + dialogId + '?endUserId=' + endUserId); | ||
expectStatusFor(r).to.equal(200); | ||
expect(r, 'response').to.have.validJsonBody(); | ||
expect(r.json(), 'dialog').to.have.property("id").to.equal(dialogId); | ||
}); | ||
|
||
describe('Perform dialog get with invalid endUserId', () => { | ||
let r = getSO('dialogs/' + dialogId + '?endUserId=' + invalidEndUserId); | ||
expectStatusFor(r).to.equal(404); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters