Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Nutshell REST API merge spec
Feature: Merging entities
Background:
Given a Nutshell with an account
@wip
Scenario: Basic JSON API compliance
When the client requests POST /accounts/1-accounts/merge with the body:
"""
{"accounts": ["336-accounts","337-accounts"] }
"""
Then the response status should be 200
And the JSON at "accounts" should be an array
And the JSON at "accounts" should have 3 entries
And the JSON at "accounts/0/phones/0" should be:
"""
{
"isPrimary": true,
"name": "phone",
"value": {
"countryCode": "1",
"extension": null,
"number": "9196696214",
"numberFormatted": "919-669-6214"
}
}
"""
And the JSON at "accounts/0/addresses" should be an array
And the JSON at "accounts/0/addresses/0" should have the following:
| isPrimary | true |
| name | "address" |
| value/address_1 | "2300 Englert Dr, Ste G" |
| value/address_2 | "" |
| value/address_3 | "" |
| value/city | "Durham" |
| value/state | "NC" |
| value/postalCode | "27713" |
| value/country | "US" |
And the JSON at "accounts/0/deletedTime" should be null
And the JSON value at "accounts/1/deletedTime" should be a timestamp
And the JSON value at "accounts/2/deletedTime" should be a timestamp
And the resource link at "links/accounts.mergedWith/href" should have the path /accounts/{accounts.mergedWith}
And the JSON should have the following:
| accounts/1/links/mergedWith | "1-accounts" |
| accounts/2/links/mergedWith | "1-accounts" |
@wip
Scenario: Mergable entites are finite
When the client requests POST /accounts/1-accounts/merge with the body:
"""
{"accounts":["2-accounts","3-accounts","4-accounts","5-accounts","6-accounts","7-accounts","8-accounts","9-accounts","10-accounts","11-accounts","12-accounts","13-accounts","14-accounts","15-accounts","16-accounts","17-accounts","18-accounts","19-accounts","20-accounts","21-accounts","22-accounts","23-accounts","24-accounts","25-accounts","26-accounts","27-accounts","28-accounts","29-accounts","30-accounts","31-accounts","32-accounts","33-accounts","34-accounts","35-accounts","36-accounts","37-accounts","38-accounts","39-accounts","40-accounts","41-accounts","42-accounts","43-accounts","44-accounts","45-accounts","46-accounts","47-accounts","48-accounts","49-accounts","50-accounts","51-accounts","52-accounts","53-accounts","54-accounts","55-accounts","56-accounts","57-accounts","58-accounts","59-accounts"]}
"""
# Not sure the response stats yet but it wont be 200
Then the response status should be 422 Unprocessable Entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.