{"info":{"_postman_id":"7dbd5bf5-2a54-4349-b835-185d1b3bd81a","name":"Notes API Test","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"29641235","collectionId":"7dbd5bf5-2a54-4349-b835-185d1b3bd81a","publishedId":"2sA3kXFgfm","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-07-25T07:44:44.000Z"},"item":[{"name":"Users","item":[{"name":"Adding User","event":[{"listen":"test","script":{"id":"d09cf358-707a-4f9e-a7aa-6bde4ddbf9a0","exec":["pm.test('response status code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('User berhasil ditambahkan');\r","    pm.expect(responseJson).to.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","})\r","\r","pm.test('response body data should have userId property and not equal to empty', () => {\r","    const responseJson = pm.response.json();\r","    const {data} = responseJson;\r","\r","    pm.expect(data).to.ownProperty('userId');\r","    pm.expect(data.userId).to.not.equals('');\r","\r","    pm.environment.set('currentUserId', data.userId);\r","})"],"type":"text/javascript","packages":{}}}],"id":"b46de0a7-44f6-441b-b4ed-26298a33661b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    // \"username\": \"1792980598-{{newUsername}}\",\r\n    // \"password\": \"{{newPassword}}\",\r\n    // \"fullname\": \"{{newFullname}}\"\r\n    \"username\": \"sherren\",\r\n    \"password\": \"12345\",\r\n    \"fullname\": \"Sherren\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/users","urlObject":{"port":"3000","path":["users"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b46de0a7-44f6-441b-b4ed-26298a33661b"},{"name":"Adding User with Exist Username","event":[{"listen":"prerequest","script":{"id":"1b41f04f-4090-4e9c-b2d9-89380ed2dbb4","exec":["const postRequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json',\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'testing',\r","            password: pm.environment.get('newPassword'),\r","            fullname: pm.environment.get('newFullname')\r","        })\r","    }\r","};\r","\r","pm.sendRequest(postRequest, (error, response) => {\r","    console.log(error ? error : response.json())\r","})"],"type":"text/javascript","packages":{}}},{"listen":"test","script":{"id":"9746cd75-dfa8-4ed3-a662-034069c213f1","exec":["pm.test('response status code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","})\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Gagal menambahkan user. Username sudah digunakan.');\r","})"],"type":"text/javascript","packages":{}}}],"id":"15ec749f-b74a-4df7-bfb3-31fbbd233738","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"testing\",\r\n    \"password\": \"{{newPassword}}\",\r\n    \"fullname\": \"{{newFullname}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/users","urlObject":{"port":"3000","path":["users"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"15ec749f-b74a-4df7-bfb3-31fbbd233738"},{"name":"Adding User with Bad User Payload","event":[{"listen":"prerequest","script":{"id":"5fd4570e-2527-4482-911d-85a27ff7712a","exec":["let badUserPayloads = pm.environment.get('badUserPayloads');\r","\r","if(!badUserPayloads || badUserPayloads.length === 0){\r","    badUserPayloads = [\r","        {password: 'secret', fullname: 'John Doe'},\r","        {username: 1, password: 'secret', fullname: 'John Doe'},\r","        {username: 'johndoe', fullname: 'John Doe'},\r","        {username: 'johndoe', password: true, fullname: 'John Doe'},\r","        {username: 'johndoe', password: 'secret'},\r","        {username: 'johndoe', password: 'secret', fullname: 0},\r","    ]\r","}\r","\r","const currentBadUserPayload = badUserPayloads.shift();\r","pm.environment.set('currentBadUserPayload', JSON.stringify(currentBadUserPayload));\r","pm.environment.set('badUserPayloads', badUserPayloads);"],"type":"text/javascript","packages":{}}},{"listen":"test","script":{"id":"773dca32-5ddf-49ac-9abd-ef89092cbe38","exec":["pm.test('response status code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.not.equals(' ');\r","    pm.expect(responseJson.message).to.not.equals(null);\r","});\r","\r","const repeatRequestUntilDatasetEmpty = () => {\r","    const badUserPayloads = pm.environment.get('badUserPayloads');\r","\r","    if(badUserPayloads && badUserPayloads.length > 0){\r","        postman.setNextRequest('Adding User with Bad User Payload');\r","    }\r","}\r","\r","repeatRequestUntilDatasetEmpty();"],"type":"text/javascript","packages":{}}}],"id":"8a6a6273-2472-483d-82d1-f65b94ccf0c6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{{currentBadUserPayload}}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/users","urlObject":{"port":"3000","path":["users"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"8a6a6273-2472-483d-82d1-f65b94ccf0c6"},{"name":"Getting User By Correct Id","event":[{"listen":"test","script":{"id":"1a5ac704-a6a7-4646-8fe4-fa906a54044b","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","});\r","\r","pm.test('response body data should contain user object', () => {\r","    const {data} = pm.response.json();\r","\r","    pm.expect(data).to.have.ownProperty('user');\r","    pm.expect(data.user).to.be.an('object');\r","});\r","\r","pm.test('user object should contain only id, username, and fullname with correct value', () => {\r","    const {data: {user}} = pm.response.json();\r","\r","    pm.expect(user).to.have.ownProperty('id');\r","    pm.expect(user.id).to.equals(pm.environment.get('currentUserId'));\r","    pm.expect(user).to.have.ownProperty('username');\r","    pm.expect(user.username).to.includes(pm.environment.get('newUsername'));\r","    pm.expect(user).to.have.ownProperty('fullname');\r","    pm.expect(user.fullname).to.equals(pm.environment.get('newFullname'));\r","});"],"type":"text/javascript","packages":{}}}],"id":"a01c2c88-d306-401e-bf58-ac8e2875f291","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/users/{{currentUserId}}","urlObject":{"port":"3000","path":["users","{{currentUserId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"a01c2c88-d306-401e-bf58-ac8e2875f291"},{"name":"Getting User By Incorrect Id","event":[{"listen":"test","script":{"id":"523d9e38-2b60-45d9-9efc-dd1f3fe0aa88","exec":["pm.test('response status code should have 404 value', () => {\r","    pm.response.to.have.status(404);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('User tidak ditemukan');\r","});"],"type":"text/javascript","packages":{}}}],"id":"c229cbb4-5767-4569-99ae-553abace04c0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/users/xxxx","urlObject":{"port":"3000","path":["users","xxxx"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"c229cbb4-5767-4569-99ae-553abace04c0"},{"name":"Search Users by Username Related to Dicoding","event":[{"listen":"prerequest","script":{"id":"6a25a335-5dec-462a-8b32-14c02f90727d","exec":["// Menambahkan user dengan username dicoding\r","const addDicodingUserRequest = {\r","    method: 'POST',\r","    url: 'http://localhost:3000/users',\r","    header: {\r","        'Content-Type': 'application/json'\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'dicoding',\r","            password:   pm.environment.get('newPassword'),\r","            fullname: 'Dicoding'\r","        }),\r","\r","    }\r","};\r","\r","pm.sendRequest(addDicodingUserRequest, (error, response) => {\r","    console.log(error ? error : response);\r","});\r","\r","// menambahkan user dengan username 'dicoding_indonesia'\r","const addDicodingIndonesiaUserRequest = {\r","    method: 'POST',\r","    url: 'http://localhost:3000/users',\r","    header: {\r","        'Content-Type': 'application/json'\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'dicoding_indonesia',\r","            password: pm.environment.get('newPassword'),\r","            fullname: 'Dicoding Indonesia',\r","        }),\r","    }\r","};\r","\r","pm.sendRequest(addDicodingIndonesiaUserRequest, (error, response) => {\r","    console.log(error ? error : response);\r","});\r","\r",""],"type":"text/javascript","packages":{}}},{"listen":"test","script":{"id":"468c5ad2-e2ca-4bb4-a949-aa6ee8348d37","exec":["pm.test('response status should be 200', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","});\r","\r","pm.test('response body data should contain users array', () => {\r","    const {data} = pm.response.json();\r","\r","    pm.expect(data).to.have.ownProperty('users');\r","    pm.expect(data.users).to.be.an('array');\r","});\r","\r","pm.test('the array users should have contain 2 user object related to dicoding username', () => {\r","    const {data: {users}} = pm.response.json();\r","\r","    pm.expect(users).to.have.lengthOf(2);\r","\r","    users.forEach((user) => {\r","        pm.expect(user).to.be.an('object');\r","        pm.expect(user).to.have.ownProperty('id');\r","        pm.expect(user).to.have.ownProperty('username');\r","        pm.expect(user).to.have.ownProperty('fullname');\r","        pm.expect(user.username).to.include('dicoding');\r","    })\r","})"],"type":"text/javascript","packages":{}}}],"id":"62f72231-4ec6-410f-9fda-6befbac3b1bf","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/users","urlObject":{"port":"3000","path":["users"],"host":["localhost"],"query":[{"disabled":true,"key":"username","value":"jerico"}],"variable":[]}},"response":[],"_postman_id":"62f72231-4ec6-410f-9fda-6befbac3b1bf"}],"id":"faf764ad-017a-4afe-8c7d-6595b3b3d7c8","_postman_id":"faf764ad-017a-4afe-8c7d-6595b3b3d7c8","description":""},{"name":"Authentications","item":[{"name":"Post Authentication with Valid Credentials","event":[{"listen":"prerequest","script":{"id":"976f4cdc-1d0d-479e-9a14-bb0ff95443f8","exec":["const postRequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json',\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'testing',\r","            password: pm.environment.get('newPassword'),\r","            fullname: pm.environment.get('newFullname')\r","        })\r","    }\r","}\r","\r","pm.sendRequest(postRequest, (error, response) => {\r","    console.log(error ? error : response.json());\r","})"],"type":"text/javascript","packages":{}}},{"listen":"test","script":{"id":"fc1bf91a-93fc-4399-b295-54d14112ffbc","exec":["pm.test('response status code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Authentication berhasil ditambahkan');\r","\r","    pm.expect(responseJson).to.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","});\r","\r","pm.test('response body data should have property accessToken and refreshToken with correct value', () => {\r","    const responseJson = pm.response.json();\r","    const { data } = responseJson;\r","\r","    pm.expect(data).to.have.ownProperty('accessToken');\r","    pm.expect(data.accessToken).to.not.equals('');\r","    pm.expect(data.accessToken).to.not.equals(null);\r","    pm.expect(data).to.have.ownProperty('refreshToken');\r","    pm.expect(data.refreshToken).to.not.equals('');\r","    pm.expect(data.refreshToken).to.not.equals(null);\r","\r","    // menyimpan accessToken dan refreshToken di environment variable\r","    pm.environment.set('accessToken', data.accessToken);\r","    pm.environment.set('refreshToken', data.refreshToken);\r","})\r",""],"type":"text/javascript","packages":{}}}],"id":"bbd279c5-bb14-4d1c-aa6b-81e0ebb3efbe","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    // \"username\": \"testing\",\r\n    // \"password\": \"{{newPassword}}\"\r\n    \"username\": \"jerico\",\r\n    \"password\": \"12345\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/authentications","urlObject":{"port":"3000","path":["authentications"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"bbd279c5-bb14-4d1c-aa6b-81e0ebb3efbe"},{"name":"Post Authentication with Invalid Credential","event":[{"listen":"test","script":{"id":"55ad0dd7-fe8c-4aad-bf19-4c91e9b6a706","exec":["pm.test('response status code should have 401 value', () => {\r","    pm.response.to.have.status(401);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Kredensial yang Anda berikan salah');\r","})"],"type":"text/javascript","packages":{}}}],"id":"78ede3c8-5ea8-4024-9909-f9da937227dc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"testing\",\r\n    \"password\": \"somebadpassword\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/authentications","urlObject":{"port":"3000","path":["authentications"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"78ede3c8-5ea8-4024-9909-f9da937227dc"},{"name":"Put Authentication with Valid Refresh Token","event":[{"listen":"test","script":{"id":"21a8be49-6249-4300-9690-5b904245f90d","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Access Token berhasil diperbarui');\r","    pm.expect(responseJson).to.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","});\r","\r","pm.test('response body data should have property accessToken with correct value', () => {\r","    const responseJson = pm.response.json();\r","    const {data} = responseJson;\r","\r","    pm.expect(data).to.have.ownProperty('accessToken');\r","    pm.expect(data.accessToken).to.not.equals('');\r","    pm.expect(data.accessToken).to.not.equals(null);\r","});"],"type":"text/javascript","packages":{}}}],"id":"fdde9f63-37e4-40dd-92be-1c856e5f256d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"refreshToken\": \"{{refreshToken}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/authentications","urlObject":{"port":"3000","path":["authentications"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"fdde9f63-37e4-40dd-92be-1c856e5f256d"},{"name":"Put Authentications with Invalid Refresh Token","event":[{"listen":"test","script":{"id":"71d9f9d3-9202-4b21-8e78-ece690bbe985","exec":["pm.test('response status code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).equals('Refresh token tidak valid');\r","})"],"type":"text/javascript","packages":{}}}],"id":"100d30e8-2d06-41ec-9a65-9fd814c02620","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"refreshToken\": \"xxxxx\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/authentications","urlObject":{"port":"3000","path":["authentications"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"100d30e8-2d06-41ec-9a65-9fd814c02620"},{"name":"Delete Authentication with Valid Refresh Token","event":[{"listen":"test","script":{"id":"1bbdd9a6-d4a6-4d8f-a1de-7497590cddbc","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Refresh token berhasil dihapus');\r","});"],"type":"text/javascript","packages":{}}}],"id":"544c2291-aa2d-4c35-bc8a-3f6d63ed0b59","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"raw","raw":"{\r\n    \"refreshToken\": \"{{refreshToken}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/authentications","urlObject":{"port":"3000","path":["authentications"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"544c2291-aa2d-4c35-bc8a-3f6d63ed0b59"},{"name":"Delete Authentication with Invalid Refresh Token","event":[{"listen":"test","script":{"id":"85118c15-7b75-4fdc-bd7f-be1d3c346cf2","exec":["pm.test('response status code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Refresh token tidak valid');\r","});"],"type":"text/javascript","packages":{}}}],"id":"cda1a891-7ed4-4b72-b674-6098ef3c8fd3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"raw","raw":"{\r\n    \"refreshToken\": \"xxxxx\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/authentications","urlObject":{"port":"3000","path":["authentications"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"cda1a891-7ed4-4b72-b674-6098ef3c8fd3"}],"id":"24856b22-2d1a-4654-8693-d75e007b7331","_postman_id":"24856b22-2d1a-4654-8693-d75e007b7331","description":""},{"name":"Notes","item":[{"name":"Adding Notes","event":[{"listen":"test","script":{"id":"51edc837-3ea8-49fe-87b8-8d5b03ef519c","exec":["pm.test('response status code should have 200 value', () => {\r","   pm.response.to.have.status(201);\r","}); \r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","  pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","}); \r","\r","pm.test('response body should an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Catatan berhasil ditambahkan');\r","    pm.expect(responseJson).to.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","});\r","\r","pm.test('response body data should have noteId property and not equal to empty', () => {\r","    const responseJson = pm.response.json();\r","    const { data } = responseJson;\r"," \r","    pm.expect(data).to.ownProperty('noteId');\r","    pm.expect(data.noteId).to.not.equals('');\r"," \r","    pm.environment.set('noteId', data.noteId);\r","});"],"type":"text/javascript","packages":{}}}],"id":"101af2d8-0d00-4986-9f67-0935e8b90bbb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n   \"title\": \"Catatan C\",\r\n   \"tags\": [\"Android\", \"Web\"],\r\n   \"body\": \"Isi dari catatan C\"\r\n} ","options":{"raw":{"language":"json"}}},"url":"localhost:3000/notes","urlObject":{"port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"101af2d8-0d00-4986-9f67-0935e8b90bbb"},{"name":"Adding Notes with Bad Note Payload","event":[{"listen":"test","script":{"id":"51edc837-3ea8-49fe-87b8-8d5b03ef519c","exec":["pm.test('response status code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r","\r","pm.test('response Content-Type header should have application/json; charset=utf-8 value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","})\r","\r","pm.test('response body should be an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","})\r","\r","pm.test('response body object should have coorect property and value', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.haveOwnProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.haveOwnProperty('message');\r","    pm.expect(responseJson.message).to.be.ok;\r","})\r","\r","const repeatRequestUntilDatasetEmpty = () => {\r","    const badNotePayloads = pm.environment.get('badNotePayloads');\r","\r","    if(badNotePayloads && badNotePayloads.length > 0){\r","        postman.setNextRequest('Adding Notes with Bad Note Payload');\r","    }\r","}\r","\r","repeatRequestUntilDatasetEmpty();"],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"0f33d483-b969-42ee-a15b-9687dda9f96d","exec":["let badNotePayloads = pm.environment.get('badNotePayloads');\r","\r","if(!badNotePayloads || badNotePayloads.length === 0){\r","    badNotePayloads = [\r","        {tags: [\"Android\", \"Web\"], body: \"Isi dari catatan A\"},\r","        {title: 1, tags: [\"Android\", \"Web\"], body: \"Isi dari catatan A\"},\r","        {title: \"Catatan A\", body: \"Isi dari catatan A\"},\r","        {title: \"Catatan A\", tags: [1, \"2\"], body: \"Isi dari catatan A\"},\r","        {title: \"Catatan A\", tags: [\"Android\", \"Web\"]},\r","        {title: \"Catatan A\", tags: [\"Android\", \"Web\"], body: true}\r","    ]\r","}\r","\r","const currentBadNotePayload = badNotePayloads.shift();\r","pm.environment.set('currentBadNotPayload', JSON.stringify(currentBadNotePayload));\r","pm.environment.set('badNotePayloads', badNotePayloads)"],"type":"text/javascript","packages":{}}}],"id":"6239615d-2e3b-40b6-a295-3ffaa69d9ee3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{{currentBadNotePayload}}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/notes","urlObject":{"port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"6239615d-2e3b-40b6-a295-3ffaa69d9ee3"},{"name":"Getting All Notes","event":[{"listen":"test","script":{"id":"6bf292bd-2d5e-4210-8876-2f625bffa13c","exec":["pm.test('response status code should have 200 value', () => {\r","   pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","   pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should an object', () => {\r","   const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.be.an('object');\r","}); \r","\r","pm.test('response body should have the correct property and value', () => {\r","  const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('success');\r","   pm.expect(responseJson).to.have.ownProperty('data');\r","   pm.expect(responseJson.data).to.be.an('object');\r","});\r","\r","pm.test('response body data should have a notes array and contain at least 1 item', () => {\r","   const responseJson = pm.response.json();\r","   const { data } = responseJson;\r"," \r","   pm.expect(data).to.have.ownProperty('notes');\r","   pm.expect(data.notes).to.be.an('array');\r","   pm.expect(data.notes).lengthOf.at.least(1);\r","}); "],"type":"text/javascript","packages":{}}}],"id":"b12daa23-8c06-453a-804a-f9e73c1633c3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"GET","header":[],"url":"localhost:3000/notes","urlObject":{"port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b12daa23-8c06-453a-804a-f9e73c1633c3"},{"name":"Getting Specified Note","event":[{"listen":"test","script":{"id":"0f380427-6c40-4269-967c-822634a65191","exec":["pm.test('response status code should have 200 value', () => {\r","  pm.response.to.have.status(200);\r","}); \r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","   pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should be an object', () => {\r","   const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have the correct property and value', () => {\r","   const responseJson = pm.response.json();\r"," \r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('success');\r","   pm.expect(responseJson).to.have.ownProperty('data');\r","   pm.expect(responseJson.data).to.be.an('object');\r","}); \r","\r","pm.test('response body data should contain note object', () => {\r","   const responseJson = pm.response.json();\r","   const { data } = responseJson;\r"," \r","   pm.expect(data).to.have.ownProperty('note');\r","   pm.expect(data.note).to.be.an('object');\r","}); \r","\r","pm.test('note object should contain correct value for id, title, body, tags and username property', () => {\r","   const responseJson = pm.response.json();\r","   const { data: { note } } = responseJson;\r","\r","   const expectedId = pm.environment.get('noteId');\r","   const expectedTitle = 'Catatan A';\r","   const expectedTags = ['Android', 'Web'];\r","   const expectedBody = 'Isi dari catatan A';\r","\r","   pm.expect(note).to.have.ownProperty('id');\r","   pm.expect(note.id).to.equals(expectedId);\r","   pm.expect(note).to.have.ownProperty('title');\r","   pm.expect(note.title).to.equals(expectedTitle);\r","   pm.expect(note).to.have.ownProperty('tags');\r","   pm.expect(note.tags).to.eql(expectedTags);\r","   pm.expect(note).to.have.ownProperty('body');\r","   pm.expect(note.body).to.equals(expectedBody);\r","   pm.expect(note).to.have.ownProperty('username');\r","   pm.expect(note.username).to.be.a('string');\r","});"],"type":"text/javascript","packages":{}}}],"id":"b45c51e9-1075-42aa-9964-196592230ed5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"GET","header":[],"url":"localhost:3000/notes/kivG5ht9G7fQsQOi","urlObject":{"port":"3000","path":["notes","kivG5ht9G7fQsQOi"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b45c51e9-1075-42aa-9964-196592230ed5"},{"name":"Update Note","event":[{"listen":"test","script":{"id":"f60cea2b-ad7f-434e-8451-376b72bdb88a","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","   pm.expect(pm.response.headers.get('Content-Type')).to.equals(\"application/json; charset=utf-8\");\r","})\r","\r","pm.test('response body should be an object', () => {\r","   const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","   const responseJson = pm.response.json();\r"," \r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('success');\r","   pm.expect(responseJson).to.have.ownProperty('message');\r","   pm.expect(responseJson.message).to.equals('Catatan berhasil diperbarui');\r","});\r","\r","pm.test('when request the updated note', () => {\r","    const noteId = pm.environment.get('noteId');\r","    const getRequest = {\r","        url: `http://localhost:3000/notes/${noteId}`,\r","        method: 'GET',\r","        header: {\r","            'Authorization': `Bearer ${pm.environment.get('accessToken')}`,\r","        }\r","    }\r","\r","    pm.sendRequest(getRequest, (error, response) => {\r","        if(!error) {\r","            pm.test('then the updated note should contain the latest data', () => {\r","                const responseJson = response.json();\r","                const { data: { note } } = responseJson;\r"," \r","                const expectedTitle = 'Catatan A Revised';\r","                const expectedTags = ['Android', 'Web'];\r","                const expectedBody = 'Isi dari Catatan A Revised';\r"," \r","                pm.expect(note.title).to.equals(expectedTitle);\r","                pm.expect(note.tags).to.eql(expectedTags);\r","                pm.expect(note.body).to.equals(expectedBody);\r","            });\r","        }\r","    });\r","});"],"type":"text/javascript","packages":{}}}],"id":"8ec6518f-b706-48ce-8ff4-a308a2d4716e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan A Revised\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari Catatan A Revised\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/notes/{{noteId}}","urlObject":{"port":"3000","path":["notes","{{noteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"8ec6518f-b706-48ce-8ff4-a308a2d4716e"},{"name":"Update Note With Bad Note Payload","event":[{"listen":"test","script":{"id":"f60cea2b-ad7f-434e-8451-376b72bdb88a","exec":["pm.test('response status code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r"," \r","pm.test('response Content-Type header should have application/json; charset=utf-8 value', () => {\r","  pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","}); \r"," \r","pm.test('response body should be an object', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.be.an('object');\r","});\r"," \r","pm.test('response body object should have correct property and value', () => {\r","    const responseJson = pm.response.json();\r","    pm.expect(responseJson).to.haveOwnProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.haveOwnProperty('message');\r","    pm.expect(responseJson.message).to.be.ok;\r","});\r"," \r","const repeatRequestUntilDatasetEmpty = () => {\r","    const badNotePayloads = pm.environment.get('badNotePayloads');\r"," \r","    if(badNotePayloads && badNotePayloads.length > 0) {\r","        postman.setNextRequest('Update Note with Bad Note Payload');\r","    }\r","}\r"," \r","repeatRequestUntilDatasetEmpty();"],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"e2a03eb4-851c-4e46-b5ee-d63490109beb","exec":["let badNotePayloads = pm.environment.get('badNotePayloads');  // ini akan bertipe Array\r"," \r","if (!badNotePayloads || badNotePayloads.length === 0) {\r","    // inisialisasi dengan sejumlah note yang tidak sesuai\r","    badNotePayloads = [\r","        { tags: [\"Android\", \"Web\"], body: \"Isi dari catatan A\" },\r","        { title: 1, tags: [\"Android\", \"Web\"], body: \"Isi dari catatan A\" },\r","        { title: \"Catatan A\", body: \"Isi dari catatan A\" },\r","        { title: \"Catatan A\", tags: [1, \"2\"], body: \"Isi dari catatan A\" },\r","        { title: \"Catatan A\", tags: [\"Android\", \"Web\"] },\r","        { title: \"Catatan A\", tags: [\"Android\", \"Web\"], body: true }\r","    ]\r","}\r"," \r","const currentBadNotePayload = badNotePayloads.shift();  // hapus index 0, geser sisanya\r","pm.environment.set('currentBadNotePayload', JSON.stringify(currentBadNotePayload));\r","pm.environment.set('badNotePayloads', badNotePayloads);"],"type":"text/javascript","packages":{}}}],"id":"28675961-195e-44a3-b883-f4d6f5696d97","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{{currentBadNotePayload}}","options":{"raw":{"language":"json"}}},"url":"localhost:3000/notes/{{noteId}}","urlObject":{"port":"3000","path":["notes","{{noteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"28675961-195e-44a3-b883-f4d6f5696d97"},{"name":"Delete Notes","event":[{"listen":"test","script":{"id":"f323934e-1df0-4f90-a3d4-4e021fadd748","exec":["pm.test('response status code should have 200 value', () => {\r","   pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","   pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8')\r","}); \r","\r","pm.test('response body should be an object', () => {\r","   const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.be.an('object');\r","});\r","\r","pm.test('response body should have correct property and value', () => {\r","   const responseJson = pm.response.json();\r"," \r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('success');\r","   pm.expect(responseJson).to.have.ownProperty('message');\r","   pm.expect(responseJson.message).to.equals('Catatan berhasil dihapus');\r","}); \r","\r","pm.test('when request the updated note', () => {\r","    const noteId = pm.environment.get('noteId');\r","    const getRequest = {\r","        url: `http://localhost:3000/notes/${noteId}`,\r","        method: 'GET',\r","        header: {\r","            'Authorization': `Bearer ${pm.environment.get('accessToken')}`,\r","        },\r","    };\r","\r","    pm.sendRequest(getRequest, (error, response) => {\r","        if(!error) {\r","            pm.test('the deleted note should be not found', () => {\r","                pm.expect(response.code).to.equals(404);\r","                const responseJson = response.json();\r","                pm.expect(responseJson.status).to.equals('fail');\r","                pm.expect(responseJson.message).to.equals('Catatan tidak ditemukan');\r","            });\r","        }\r","    });\r","});"],"type":"text/javascript","packages":{}}}],"id":"5bcf8a91-a2b1-4d2e-ae3f-3c51b58c15b3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessToken}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"localhost:3000/notes/{{noteId}}","urlObject":{"port":"3000","path":["notes","{{noteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"5bcf8a91-a2b1-4d2e-ae3f-3c51b58c15b3"},{"name":"Getting All Notes without Access Token","event":[{"listen":"test","script":{"id":"d715d155-797c-4261-905c-ab74b6f588b7","exec":["pm.test('response status cod should have 401 value', () => {\r","    pm.response.to.have.status(401);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","})"],"type":"text/javascript","packages":{}}}],"id":"1eff7c16-5faf-40ea-8747-03b5c6703d9b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:3000/notes","urlObject":{"port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"1eff7c16-5faf-40ea-8747-03b5c6703d9b"}],"id":"a5f3710e-4bcb-4662-96aa-ec9acab09f59","_postman_id":"a5f3710e-4bcb-4662-96aa-ec9acab09f59","description":""},{"name":"Authorizations","item":[{"name":"Adding Notes using User A","event":[{"listen":"test","script":{"id":"6b524a10-6701-44c0-93e8-0025e5a1c3ab","exec":["pm.test('response status code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains note id', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('noteId');\r","    pm.expect(responseJson.data.noteId).to.be.a('string');\r","\r","    // memasukkan noteId ke dalam environment variable\r","    pm.environment.set('noteIdUserA', responseJson.data.noteId);\r","})"],"type":"text/javascript","packages":{}}}],"id":"1fd37c43-39cc-43b0-a9b8-1c523432b380","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan A\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari catatan A\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"1fd37c43-39cc-43b0-a9b8-1c523432b380"},{"name":"Adding Notes using User B","event":[{"listen":"test","script":{"id":"66ca89e4-7e47-4b64-abc8-def9d344d3f0","exec":["pm.test('response status code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains note id', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('noteId');\r","    pm.expect(responseJson.data.noteId).to.be.a('string');\r","\r","    // memasukkan noteId ke dalam environment variable\r","    pm.environment.set('noteIdUserB', responseJson.data.noteId);\r","});"],"type":"text/javascript","packages":{}}}],"id":"8d6f8511-1171-43a6-998f-693dafbeafd3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan B\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari catatan B\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"8d6f8511-1171-43a6-998f-693dafbeafd3"},{"name":"Getting All Notes using User A","event":[{"listen":"test","script":{"id":"ac5acf13-4dfa-455c-832a-872c9a4cbbe5","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains notes array with 1 item', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('notes');\r","    pm.expect(responseJson.data.notes).to.be.an('array');\r","    pm.expect(responseJson.data.notes).to.have.lengthOf(1);\r","})\r",""],"type":"text/javascript","packages":{}}}],"id":"87780265-e204-4b98-b670-1b8749ccb73f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"87780265-e204-4b98-b670-1b8749ccb73f"},{"name":"Getting All Notes using User B","event":[{"listen":"test","script":{"id":"15a1c8d4-d63e-4f4f-bd76-8a09e1cf7321","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains notes array with 1 item', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('notes');\r","    pm.expect(responseJson.data.notes).to.be.an('array');\r","    pm.expect(responseJson.data.notes).to.have.lengthOf(1);\r","})"],"type":"text/javascript","packages":{}}}],"id":"96db9dc0-251c-4f55-8a87-82eee46d539b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"96db9dc0-251c-4f55-8a87-82eee46d539b"},{"name":"Getting Note Owned by User A using User A","event":[{"listen":"test","script":{"id":"8722a84b-061e-49c2-93ff-d571c2329bb9","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains object note', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('note');\r","    pm.expect(responseJson.data.note).to.be.an('object');\r","})"],"type":"text/javascript","packages":{}}}],"id":"c176908f-5339-4724-bfd9-466d7ab71668","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes/{{noteIdUserA}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserA}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"c176908f-5339-4724-bfd9-466d7ab71668"},{"name":"Getting Note Owned by User B using User B","event":[{"listen":"test","script":{"id":"6f2366e4-aed8-49b6-adf0-801aacc82c31","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains object note', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('note');\r","    pm.expect(responseJson.data.note).to.be.an('object');\r","});"],"type":"text/javascript","packages":{}}}],"id":"b2219d4f-7f68-4c1b-a78b-4e18c985f57b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes/{{noteIdUserB}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserB}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b2219d4f-7f68-4c1b-a78b-4e18c985f57b"},{"name":"Getting Note Owned by User A using User B","event":[{"listen":"test","script":{"id":"3eaa11dd-d0e6-4e43-93ed-40684018adb0","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});"],"type":"text/javascript","packages":{}}}],"id":"048ca814-1050-489a-8410-7e9c337bd98e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes/{{noteIdUserA}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserA}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"048ca814-1050-489a-8410-7e9c337bd98e"},{"name":"Update Note Owned by User A using User A","event":[{"listen":"test","script":{"id":"5dc94ff3-a8c5-47bb-848a-4e4d1ec70cbf","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r",""],"type":"text/javascript","packages":{}}}],"id":"14cdb3fe-2133-47da-bca7-5a74298ae9f0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan A Revised\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari Catatan A Revised\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes/{{noteIdUserA}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserA}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"14cdb3fe-2133-47da-bca7-5a74298ae9f0"},{"name":"Update Note Owned by User B using User B","event":[{"listen":"test","script":{"id":"0ad5903c-ed00-4cb1-8866-b5e34bfacc5b","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"62ebbd91-e386-42d6-be77-4516f826f417","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan B Revised\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari Catatan B Revised\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes/{{noteIdUserB}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserB}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"62ebbd91-e386-42d6-be77-4516f826f417"},{"name":"Update Note Owned by User A using User B","event":[{"listen":"test","script":{"id":"5f026fa8-bf3e-440c-8592-31a0df14882f","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"071b36fb-23d4-4356-b3f0-eee7aeb45abe","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"catatan A Revised Again\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari Catatan A Revised Again\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes/{{noteIdUserA}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserA}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"071b36fb-23d4-4356-b3f0-eee7aeb45abe"},{"name":"Delete Note Owned by User A using User B","event":[{"listen":"test","script":{"id":"df167a54-db64-4684-9028-65526a5bbc3c","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});"],"type":"text/javascript","packages":{}}}],"id":"a551179c-0e07-41e2-8742-f0adf7d8e57a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3000/notes/{{noteIdUserA}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserA}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"a551179c-0e07-41e2-8742-f0adf7d8e57a"},{"name":"Delete Note Owned by User A using User A","event":[{"listen":"test","script":{"id":"bbb52a7e-e9b7-4497-bf86-312de82fae99","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r",""],"type":"text/javascript","packages":{}}}],"id":"ade885b5-82db-41fe-9315-eb6071e50227","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3000/notes/{{noteIdUserA}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserA}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"ade885b5-82db-41fe-9315-eb6071e50227"},{"name":"Delete Note Owned by User B using User B","event":[{"listen":"test","script":{"id":"1301024b-b2ed-4e5d-8fe4-ba5bb5b6cd61","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"7d95f58b-a2da-47d5-8b80-451de28c1813","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserB}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3000/notes/{{noteIdUserB}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{noteIdUserB}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"7d95f58b-a2da-47d5-8b80-451de28c1813"}],"id":"3eb553d1-54c0-4ad4-a8df-56834b34c5cc","event":[{"listen":"prerequest","script":{"id":"f407d1f4-ede1-47ae-a244-52aa106d397b","type":"text/javascript","packages":{},"exec":["// membuat User A\r","const createUserARequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json'\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'user_a',\r","            password: 'secret',\r","            fullname: 'User A'\r","        }),\r","    },\r","};\r","\r","pm.sendRequest(createUserARequest, (error, response) => {\r","    console.log(error ? error : response);\r","\r","    // Setelah terdaftar, login dengan User A\r","    const loginUserRequest = {\r","        url: 'http://localhost:3000/authentications',\r","        method: 'POST',\r","        header: {\r","            'Content-Type': 'application/json',\r","        },\r","        body: {\r","            mode: 'raw',\r","            raw: JSON.stringify({\r","                username: 'user_a',\r","                password: 'secret'\r","            })\r","        }\r","    }\r","\r","    pm.sendRequest(loginUserRequest, (error, response) => {\r","        if(!error) {\r","            // memasukkan access token User A ke environment variabel\r","            const {data: {accessToken}} = response.json();\r","            pm.environment.set('accessTokenUserA', accessToken);\r","        }\r","    });\r","});\r","\r","// membuat User B\r","const createUserBRequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json',\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'user_b',\r","            password: 'secret',\r","            fullname: 'User B'\r","        }),\r","    },\r","};\r","\r","pm.sendRequest(createUserBRequest, (error, response) => {\r","    console.log(error ? error : response);\r","\r","    // Setelah terdaftar, login dengan User B\r","    const loginUserRequest = {\r","        url: 'http://localhost:3000/authentications',\r","        method: 'POST',\r","        header: {\r","            'Content-Type': 'application/json',\r","        },\r","        body: {\r","            mode: 'raw',\r","            raw: JSON.stringify({\r","                username: 'user_b',\r","                password: 'secret'\r","            }),\r","        },\r","    };\r","\r","    pm.sendRequest(loginUserRequest, (error, response) => {\r","        if(!error) {\r","            // memasukkan access token User B ke environment variabel\r","            const { data: {accessToken}} = response.json();\r","            pm.environment.set('accessTokenUserB', accessToken);\r","        }\r","    });\r","});"]}},{"listen":"test","script":{"id":"99a558c2-7f60-405f-be05-173e36494b61","type":"text/javascript","packages":{},"exec":[""]}}],"_postman_id":"3eb553d1-54c0-4ad4-a8df-56834b34c5cc","description":""},{"name":"Collaborations","item":[{"name":"Adding Note using Owner User","event":[{"listen":"test","script":{"id":"f698e45c-ca82-47b0-b6ba-982876946247","exec":["pm.test('response status code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains note id', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('noteId');\r","    pm.expect(responseJson.data.noteId).to.be.a('string');\r","\r","    // memasukkan noteId ke dalam environment variabel\r","    pm.environment.set('ownerNoteId', responseJson.data.noteId);\r","})"],"type":"text/javascript","packages":{}}}],"id":"3eb74c37-2c84-4a05-9f9a-8c9d73e6ad9e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ownerAccessToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan A\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari catatan A\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"3eb74c37-2c84-4a05-9f9a-8c9d73e6ad9e"},{"name":"Adding Collaborator User as Collaborator to Added Note","event":[{"listen":"test","script":{"id":"01a59755-c0c0-4657-b380-bb01e7154653","exec":["pm.test('response status code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r","\r","pm.test('response Content-Type header should  have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should have collaborationId', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('collaborationId');\r","    pm.expect(responseJson.data.collaborationId).to.be.a('string');\r","});"],"type":"text/javascript","packages":{}}}],"id":"77695e2b-2607-4a20-9505-bdd375a1f972","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ownerAccessToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"noteId\": \"{{ownerNoteId}}\",\r\n    \"userId\": \"{{collaboratorUserId}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/collaborations","urlObject":{"protocol":"http","port":"3000","path":["collaborations"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"77695e2b-2607-4a20-9505-bdd375a1f972"},{"name":"Getting All Notes using Collaborator","event":[{"listen":"test","script":{"id":"f43470f5-8867-4256-8bdc-d2e4574b9776","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains notes array with 1 item', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('notes');\r","    pm.expect(responseJson.data.notes).to.be.an('array');\r","    pm.expect(responseJson.data.notes).to.have.lengthOf(1);\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"eddf9581-f8b5-4aa3-95dd-bb4f144664d8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"eddf9581-f8b5-4aa3-95dd-bb4f144664d8"},{"name":"Getting Added Note using Collaborator User","event":[{"listen":"test","script":{"id":"f509df4f-1cc7-456f-a739-92816a0dbe41","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});"],"type":"text/javascript","packages":{}}}],"id":"1073f77a-3d2b-4cb7-8ad6-a4fae1db853c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes/{{ownerNoteId}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{ownerNoteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"1073f77a-3d2b-4cb7-8ad6-a4fae1db853c"},{"name":"Editing Added Note using Collaborator User","event":[{"listen":"test","script":{"id":"2c9f767a-7980-424f-8bb9-383e6a74a931","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"f6c4f2fa-f70b-4afa-8afd-02229ce34b2c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan A Revised\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari Catatan A Revised by collaborator\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes/{{ownerNoteId}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{ownerNoteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"f6c4f2fa-f70b-4afa-8afd-02229ce34b2c"},{"name":"Deleting Added Note using Collaborator User","event":[{"listen":"test","script":{"id":"42660058-e636-4eca-92a9-c198aa724236","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"d8b7be9d-8b7a-41de-85be-e646a7bc9b20","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3000/notes/{{ownerNoteId}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{ownerNoteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"d8b7be9d-8b7a-41de-85be-e646a7bc9b20"},{"name":"Delete Collaborator User from Collaborator to Added Note","event":[{"listen":"test","script":{"id":"2314f8df-329f-44f7-a9e2-0d1ca554e473","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Kolaborasi berhasil dihapus');\r","});"],"type":"text/javascript","packages":{}}}],"id":"564bf09e-26d3-4203-97c9-f4cdca55709c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ownerAccessToken}}"}]},"isInherited":false},"method":"DELETE","header":[],"body":{"mode":"raw","raw":"{\r\n    \"noteId\": \"{{ownerNoteId}}\",\r\n    \"userId\": \"{{collaboratorUserId}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/collaborations","urlObject":{"protocol":"http","port":"3000","path":["collaborations"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"564bf09e-26d3-4203-97c9-f4cdca55709c"},{"name":"Adding Collaborator User as Collaborator to Added Note using Collaborator User","event":[{"listen":"test","script":{"id":"04bae4e4-196d-4819-a299-cc62ce949aee","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});"],"type":"text/javascript","packages":{}}}],"id":"5784d033-3564-4586-bfca-0d57e20a1d08","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"noteId\": \"{{ownerNoteId}}\",\r\n    \"userId\": \"{{collaboratorUserId}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/collaborations","urlObject":{"protocol":"http","port":"3000","path":["collaborations"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"5784d033-3564-4586-bfca-0d57e20a1d08"},{"name":"Getting All Notes using Collaborator User","event":[{"listen":"test","script":{"id":"99b12505-e4e9-498c-9452-5de56f534b55","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body data should contains notes array with 0 item', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r","    pm.expect(responseJson.data).to.be.an('object');\r","    pm.expect(responseJson.data).to.have.ownProperty('notes');\r","    pm.expect(responseJson.data.notes).to.be.an('array');\r","    pm.expect(responseJson.data.notes).to.have.lengthOf(0); \r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"0e0a734b-a827-4223-bf6a-3ec83dd60bf4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes","urlObject":{"protocol":"http","port":"3000","path":["notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"0e0a734b-a827-4223-bf6a-3ec83dd60bf4"},{"name":"Getting Added Note using Collaborator User","event":[{"listen":"test","script":{"id":"8240ed74-30f6-4157-a3ff-ac52e462aa52","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value',() => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});"],"type":"text/javascript","packages":{}}}],"id":"ac30c597-5de5-4fc9-86cc-736a71797ab7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:3000/notes/{{ownerNoteId}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{ownerNoteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"ac30c597-5de5-4fc9-86cc-736a71797ab7"},{"name":"Editing Added Note using Collaborator User","event":[{"listen":"test","script":{"id":"f14db083-43ce-4f87-8a42-3740756fd857","exec":["pm.test('response status code should have 403 value', () => {\r","    pm.response.to.have.status(403);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r","pm.test('response body should contain correct value', () => {\r","    const responseJson = pm.response.json();\r","\r","    pm.expect(responseJson).to.be.an('object');\r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson.status).to.equals('fail');\r","    pm.expect(responseJson).to.have.ownProperty('message');\r","    pm.expect(responseJson.message).to.equals('Anda tidak berhak mengakses resource ini');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"b3ec671a-7278-4af8-a6b2-4c4285e33106","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{collaboratorAccessToken}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"Catatan A Revised\",\r\n    \"tags\": [\"Android\", \"Web\"],\r\n    \"body\": \"Isi dari Catatan A Revised by collaborator\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/notes/{{ownerNoteId}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{ownerNoteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b3ec671a-7278-4af8-a6b2-4c4285e33106"},{"name":"Deleting Added Note using Ower User","event":[{"listen":"test","script":{"id":"cdb92239-56a4-4347-9dd6-17fe26b90279","exec":["pm.test('response status code should have 200 value', () => {\r","    pm.response.to.have.status(200);\r","});\r","\r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r","\r",""],"type":"text/javascript","packages":{}}}],"id":"958177c1-577f-4a81-b39a-23c2b95c6135","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ownerAccessToken}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"http://localhost:3000/notes/{{ownerNoteId}}","urlObject":{"protocol":"http","port":"3000","path":["notes","{{ownerNoteId}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"958177c1-577f-4a81-b39a-23c2b95c6135"}],"id":"4dc920f0-b51f-4dbd-98d1-2252636fd47b","event":[{"listen":"prerequest","script":{"id":"31fd5b8c-2a06-44ed-93a6-fba3dc14bcad","type":"text/javascript","packages":{},"exec":["// Membuat Owner User\r","const createOwnerUserRequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json',\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'owner_user',\r","            password: 'secret',\r","            fullname: 'Owner',\r","        })\r","    }\r","}\r","\r","pm.sendRequest(createOwnerUserRequest, (error, response) => {\r","    console.log(error ? error :response)\r","\r","    // setelah terdaftar, login sebagai Owner User\r","    const loginOwnerUserRequest = {\r","        url: 'http://localhost:3000/authentications',\r","        method: 'POST',\r","        header: {\r","            'Content-Type': 'application/json',\r","        },\r","        body: {\r","            mode: 'raw',\r","            raw: JSON.stringify({\r","                username: 'owner_user',\r","                password: 'secret',\r","            }),\r","        }\r","    }\r","\r","    pm.sendRequest(loginOwnerUserRequest, (error, response) => {\r","        if(!error) {\r","            // memasukkan access token Owner User ke environment variabel\r","            const {data: {accessToken}} = response.json();\r","            pm.environment.set('ownerAccessToken', accessToken);\r","        }\r","    });\r","});\r","\r","// Membuat collaborator User\r","const createCollaboratorUserRequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json',\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'collaborator_user',\r","            password: 'secret',\r","            fullname: 'Collaborator'\r","        })\r","    }\r","}\r","\r","pm.sendRequest(createCollaboratorUserRequest, (error, response) => {\r","    console.log(error ? error : response);\r","\r","    if(!error) {\r","        if(response.code === 201){\r","            // memasukkan id collaborator user ke environment variabel\r","            const {data: {userId}} = response.json();\r","            pm.environment.set('collaboratorUserId', userId);\r","        }\r","    }\r","\r","    // Setelah terdaftar, login dengan Collaborator User\r","    const loginCollaboratorUserRequest = {\r","        url: 'http://localhost:3000/authentications',\r","        method: 'POST',\r","        header: {\r","            'Content-Type': 'application/json',\r","        },\r","        body: {\r","            mode: 'raw',\r","            raw: JSON.stringify({\r","                username: 'collaborator_user',\r","                password: 'secret'\r","            })\r","        }\r","    }\r","\r","    pm.sendRequest(loginCollaboratorUserRequest, (error, response) => {\r","        if(!error){\r","            // memasukkan access token owner User ke environment variabel\r","            const {data: {accessToken}} = response.json();\r","            pm.environment.set('collaboratorAccessToken', accessToken);\r","        }\r","    })\r","})"]}},{"listen":"test","script":{"id":"ff6b0549-d541-492a-bf21-adafba6185bd","type":"text/javascript","packages":{},"exec":[""]}}],"_postman_id":"4dc920f0-b51f-4dbd-98d1-2252636fd47b","description":""},{"name":"Exports","item":[{"name":"Exports Notes with Valid Payload","event":[{"listen":"prerequest","script":{"id":"b4aa1629-273a-420f-82c9-d47fb3230fe9","exec":[""],"type":"text/javascript","packages":{}}},{"listen":"test","script":{"id":"c353bb9d-13de-4c16-8420-b588984db0a0","exec":["pm.test('response code should have 201 value', () => {\r","    pm.response.to.have.status(201);\r","});\r"," \r","pm.test('response Content-Type header should have application/json value', () => {\r","  pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r"," \r","pm.test('response body should be an object', () => {\r","   const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.be.an('object');\r","});\r"," \r","pm.test('response body should have the correct property and value', () => {\r","   const responseJson = pm.response.json();\r"," \r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('success');\r","   pm.expect(responseJson).to.have.ownProperty('message');\r","   pm.expect(responseJson.message).to.equals('Permintaan Anda dalam antrean');\r","});"],"type":"text/javascript","packages":{}}}],"id":"77734d18-bce6-497e-8643-88d3d0300e35","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    // \"targetEmail\": \"jericokatong@gmail.com\"\r\n    \"targetEmail\": \"s2200041@student.unklab.ac.id\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/export/notes","urlObject":{"protocol":"http","port":"3000","path":["export","notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"77734d18-bce6-497e-8643-88d3d0300e35"},{"name":"Exports Notes with Bad Payload","event":[{"listen":"prerequest","script":{"id":"b4aa1629-273a-420f-82c9-d47fb3230fe9","exec":[""],"type":"text/javascript","packages":{}}},{"listen":"test","script":{"id":"c353bb9d-13de-4c16-8420-b588984db0a0","exec":["pm.test('response code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r"," \r","pm.test('response Content-Type header should have application/json value', () => {\r","  pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r"," \r","pm.test('response body should be an object', () => {\r","   const responseJson = pm.response.json();\r","   pm.expect(responseJson).to.be.an('object');\r","});\r"," \r","pm.test('response body should have the correct property and value', () => {\r","   const responseJson = pm.response.json();\r"," \r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('fail');\r","   pm.expect(responseJson).to.have.ownProperty('message');\r","   pm.expect(responseJson.message).to.be.a('string');\r","});\r"," \r","const repeatRequestUntilDatasetEmpty = () => {\r","    const badExportPayloads = pm.environment.get('badExportPayloads');\r"," \r","    if(badExportPayloads && badExportPayloads.length > 0) {\r","        postman.setNextRequest('Exports Notes with Bad Payload');\r","    }\r","}\r"," \r","repeatRequestUntilDatasetEmpty();"],"type":"text/javascript","packages":{}}}],"id":"df1bc2f4-d36a-457f-8603-083785949c98","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{accessTokenUserA}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{{currentBadExportPayload}}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/export/notes","urlObject":{"protocol":"http","port":"3000","path":["export","notes"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"df1bc2f4-d36a-457f-8603-083785949c98"}],"id":"b2d6c9cf-bf47-4fde-9516-8024f96d9438","event":[{"listen":"prerequest","script":{"id":"373225fc-cc2a-4f43-8fc2-bbef9b565988","type":"text/javascript","packages":{},"exec":["// membuat User A \r","const createUserARequest = {\r","    url: 'http://localhost:3000/users',\r","    method: 'POST',\r","    header: {\r","        'Content-Type': 'application/json',\r","    },\r","    body: {\r","        mode: 'raw',\r","        raw: JSON.stringify({\r","            username: 'user_a',\r","            password: 'secret',\r","            fullname: 'User A',\r","        }),\r","    },\r","};\r"," \r","pm.sendRequest(createUserARequest, (error, response) => {\r","    console.log(error ? error : response);\r"," \r","    // Setelah terdaftar, login dengan User A\r","    const loginUserRequest = {\r","        url: 'http://localhost:3000/authentications',\r","        method: 'POST',\r","        header: {\r","            'Content-Type': 'application/json',\r","        },\r","        body: {\r","            mode: 'raw',\r","            raw: JSON.stringify({\r","                username: 'user_a',\r","                password: 'secret',\r","            }),\r","        },\r","    };\r"," \r","    pm.sendRequest(loginUserRequest, (error, response) => {\r","        if (!error) {\r","            // memasukkan access token User A ke environment variabel\r","            const { data: { accessToken } } = response.json();\r","            pm.environment.set('accessTokenUserA', accessToken);\r","        }\r","    });\r","});"]}},{"listen":"test","script":{"id":"a139242b-b200-4ebc-9d11-58411232b6c2","type":"text/javascript","packages":{},"exec":[""]}}],"_postman_id":"b2d6c9cf-bf47-4fde-9516-8024f96d9438","description":""},{"name":"Uploads","item":[{"name":"Upload Image","event":[{"listen":"test","script":{"id":"ad8d2745-e8ce-41e1-8f5a-4c40dcd34030","exec":["pm.test('response status should be 201', () => {\r","    pm.response.to.have.status(201);\r","});\r"," \r","pm.test('response Content-Type header should have application/json value', () => {\r","    pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r"," \r","pm.test('response should contains fileLocation in body data response', () => {\r","    const responseJson = pm.response.json();\r"," \r","    pm.expect(responseJson).to.have.ownProperty('status');\r","    pm.expect(responseJson).to.have.ownProperty('data');\r"," \r","    pm.expect(responseJson.status).to.equals('success');\r","    pm.expect(responseJson.data).to.be.an('object');\r"," \r","    const { data } = responseJson;\r"," \r","    pm.expect(data).to.have.ownProperty('fileLocation');\r","    pm.expect(data.fileLocation).to.be.a('string');\r","    pm.expect(data.fileLocation).to.not.equals('');\r"," \r","    // memasukkan fileLocation ke environment variable\r","    pm.environment.set('fileLocation', data.fileLocation);\r","});\r"," \r","pm.test('when requesting the fileLocation', () => {\r","    const fileLocation = pm.environment.get('fileLocation');\r"," \r","    pm.sendRequest(fileLocation, (_, response) => {\r","        pm.test('response code should be 200', () => {\r","            pm.expect(response.code).to.equals(200);\r","        })\r","    });\r","});"],"type":"text/javascript","packages":{}}}],"id":"e42afd9f-3c0f-4cce-a066-4158d5108828","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"data","type":"file","src":"/C:/Users/JERICO/Pictures/naruto pict/flower.jpg"}]},"url":"http://localhost:3000/upload/images","urlObject":{"protocol":"http","port":"3000","path":["upload","images"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"e42afd9f-3c0f-4cce-a066-4158d5108828"},{"name":"Upload Image with Non-Image File","event":[{"listen":"test","script":{"id":"ad8d2745-e8ce-41e1-8f5a-4c40dcd34030","exec":["pm.test('response code should have 400 value', () => {\r","    pm.response.to.have.status(400);\r","});\r"," \r","pm.test('response Content-Type header should have application/json value', () => {\r","  pm.expect(pm.response.headers.get('Content-Type')).to.equals('application/json; charset=utf-8');\r","});\r"," \r","pm.test('response body should have the correct property and value', () => {\r","   const responseJson = pm.response.json();\r"," \r","   pm.expect(responseJson).to.have.ownProperty('status');\r","   pm.expect(responseJson.status).to.equals('fail');\r","   pm.expect(responseJson).to.have.ownProperty('message');\r","   pm.expect(responseJson.message).to.be.a('string');\r","});"],"type":"text/javascript","packages":{}}}],"id":"39fc562f-2705-4055-b888-6143c9fe1d24","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"data","type":"file","src":"/C:/Users/JERICO/Pictures/naruto pict/coba.txt"}]},"url":"http://localhost:3000/upload/images","urlObject":{"protocol":"http","port":"3000","path":["upload","images"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"39fc562f-2705-4055-b888-6143c9fe1d24"}],"id":"5958db10-897f-4805-a151-17901a410816","_postman_id":"5958db10-897f-4805-a151-17901a410816","description":""}]}