How to use withPath method in frisby

Best JavaScript code snippet using frisby

recipes.effect.spec.ts

Source:recipes.effect.spec.ts Github

copy

Full Screen

...29 const {30 body: { token }31 } = await pipe(32 request('POST'),33 request.withPath('/api/auth'),34 request.withBody({ email: 'test@test', password: 'test' }),35 request.send36 )37 const response = await pipe(38 request('POST'),39 request.withPath('/api/recipes'),40 request.withHeaders({ Authorization: `Bearer ${token}` }),41 request.withBody({42 title: 'test recipe 1',43 ingredients: { code: '100g' },44 preparation: 'mix all together, put in the oven',45 time: '100m'46 }),47 request.send48 )49 expect(response.statusCode).toBe(200)50 expect(response.body.message).toBe(`recipe sucessfully created, wait for admin publish it`)51 })52 it('should get error when try to create a recipe withou body', async () => {53 const { request } = await testBedSetup.useTestBed()54 const {55 body: { token }56 } = await pipe(57 request('POST'),58 request.withPath('/api/auth'),59 request.withBody({ email: 'test@test', password: 'test' }),60 request.send61 )62 const response = await pipe(63 request('POST'),64 request.withPath('/api/recipes'),65 request.withHeaders({ Authorization: `Bearer ${token}` }),66 request.send67 )68 expect(response.statusCode).toBe(400)69 })70 it('should not active a recipe when is user', async () => {71 const { request } = await testBedSetup.useTestBed()72 const {73 body: { token }74 } = await pipe(75 request('POST'),76 request.withPath('/api/auth'),77 request.withBody({ email: 'test@test', password: 'test' }),78 request.send79 )80 const response = await pipe(81 request('PATCH'),82 request.withPath('/api/recipes/1/active'),83 request.withHeaders({ Authorization: `Bearer ${token}` }),84 request.send85 )86 expect(response.statusCode).toBe(401)87 })88 it('should not active a recipe with invalid token', async () => {89 const { request } = await testBedSetup.useTestBed()90 const response = await pipe(91 request('PATCH'),92 request.withPath('/api/recipes/1/active'),93 request.withHeaders({ Authorization: `Bearer DASDSSA5sd5d1s5ad` }),94 request.send95 )96 expect(response.statusCode).toBe(401)97 })98 it('should active a recipe when is admin', async () => {99 const { request } = await testBedSetup.useTestBed()100 const {101 body: { token }102 } = await pipe(103 request('POST'),104 request.withPath('/api/auth'),105 request.withBody({ email: 'admin@test', password: 'admin' }),106 request.send107 )108 const response = await pipe(109 request('PATCH'),110 request.withPath('/api/recipes/1/active'),111 request.withHeaders({ Authorization: `Bearer ${token}` }),112 request.send113 )114 expect(response.statusCode).toBe(200)115 expect(response.body.data.published).toBe(true)116 })117 it('should get error when try to active a recipe not found', async () => {118 const { request } = await testBedSetup.useTestBed()119 const {120 body: { token }121 } = await pipe(122 request('POST'),123 request.withPath('/api/auth'),124 request.withBody({ email: 'admin@test', password: 'admin' }),125 request.send126 )127 const response = await pipe(128 request('PATCH'),129 request.withPath('/api/recipes/1000/active'),130 request.withHeaders({ Authorization: `Bearer ${token}` }),131 request.send132 )133 expect(response.statusCode).toBe(404)134 })135 it('should get error when try to update a recipe not found', async () => {136 const { request } = await testBedSetup.useTestBed()137 const {138 body: { token }139 } = await pipe(140 request('POST'),141 request.withPath('/api/auth'),142 request.withBody({ email: 'admin@test', password: 'admin' }),143 request.send144 )145 const response = await pipe(146 request('PATCH'),147 request.withPath('/api/recipes/1000'),148 request.withHeaders({ Authorization: `Bearer ${token}` }),149 request.withBody({ title: 'new recipe test name' }),150 request.send151 )152 expect(response.statusCode).toBe(404)153 })154 it('should update a recipe sucessfully', async () => {155 const { request } = await testBedSetup.useTestBed()156 const {157 body: { token }158 } = await pipe(159 request('POST'),160 request.withPath('/api/auth'),161 request.withBody({ email: 'admin@test', password: 'admin' }),162 request.send163 )164 const create = await pipe(165 request('POST'),166 request.withPath('/api/recipes'),167 request.withHeaders({ Authorization: `Bearer ${token}` }),168 request.withBody({169 title: 'test recipe 1',170 ingredients: { code: '100g' },171 preparation: 'mix all together, put in the oven',172 time: '100m'173 }),174 request.send175 )176 const update = await pipe(177 request('PATCH'),178 request.withPath(`/api/recipes/${create.body.data.id}`),179 request.withHeaders({ Authorization: `Bearer ${token}` }),180 request.withBody({ title: 'new recipe test name' }),181 request.send182 )183 expect(update.statusCode).toBe(200)184 expect(create.body.data.title).toBe('test recipe 1')185 expect(update.body.data.title).toBe('new recipe test name')186 expect(update.body.data.published).toBe(false)187 })188 it('should delete a recipe sucessfully', async () => {189 const { request } = await testBedSetup.useTestBed()190 const {191 body: { token }192 } = await pipe(193 request('POST'),194 request.withPath('/api/auth'),195 request.withBody({ email: 'admin@test', password: 'admin' }),196 request.send197 )198 const response = await pipe(199 request('DELETE'),200 request.withPath('/api/recipes/1'),201 request.withHeaders({ Authorization: `Bearer ${token}` }),202 request.send203 )204 expect(response.statusCode).toBe(200)205 expect(response.body.data.deletedAt).toBeDefined()206 })207 it('should get error when trying to delete a recipe not found', async () => {208 const { request } = await testBedSetup.useTestBed()209 const {210 body: { token }211 } = await pipe(212 request('POST'),213 request.withPath('/api/auth'),214 request.withBody({ email: 'admin@test', password: 'admin' }),215 request.send216 )217 const response = await pipe(218 request('DELETE'),219 request.withPath('/api/recipes/1000'),220 request.withHeaders({ Authorization: `Bearer ${token}` }),221 request.send222 )223 expect(response.statusCode).toBe(404)224 })225 it('should get a recipe sucessfully', async () => {226 const { request } = await testBedSetup.useTestBed()227 const response = await pipe(request('GET'), request.withPath('/api/recipes/1'), request.send)228 expect(response.statusCode).toBe(200)229 expect(response.body.data).toBeDefined()230 })231 it('should get erro when recipe not found', async () => {232 const { request } = await testBedSetup.useTestBed()233 const response = await pipe(request('GET'), request.withPath('/api/recipes/100'), request.send)234 expect(response.statusCode).toBe(404)235 })236 it('should search a recipe sucessfully', async () => {237 await prisma.recipe.createMany({238 data: [239 {240 title: 'Banana Yogurt Cake',241 ingredients: JSON.stringify({242 'white suggar': '3/4 cup',243 'melted butter': '1/2 cup',244 eggs: '2',245 banana: '2 medium'246 }),247 preparation: 'combine all together, bake',248 time: '120m',249 published: true,250 authorId: 1251 },252 {253 title: 'Vegan Banana Yogurt Cake',254 ingredients: JSON.stringify({255 'white suggar': '3/4 cup',256 'melted butter': '1/2 cup',257 'linseed gel': '1/2 cup',258 banana: '2 medium'259 }),260 preparation: 'combine all together, bake',261 time: '130m',262 published: true,263 authorId: 1264 },265 {266 title: 'Apple Yogurt Cake',267 ingredients: JSON.stringify({268 'white suggar': '3/4 cup',269 'melted butter': '1/2 cup',270 eggs: '1/2 cup',271 apple: '2 big'272 }),273 preparation: 'combine all together, bake',274 time: '120m',275 published: false,276 authorId: 1277 }278 ]})279 280 const { request } = await testBedSetup.useTestBed()281 const response = await pipe(282 request('GET'),283 request.withPath('/api/recipes?search=Banana&limit=2&page=1'),284 request.send285 )286 expect(response.statusCode).toBe(200)287 expect(response.body.data).toHaveLength(2)288 })289 it('should search a recipe sucessfully with combineted filters', async () => {290 const { request } = await testBedSetup.useTestBed()291 const response = await pipe(292 request('GET'),293 request.withPath('/api/recipes?search=Banana,!egg&limit=2&page=1'),294 request.send295 )296 expect(response.statusCode).toBe(200)297 expect(response.body.data).toHaveLength(1)298 })299 it('should search a recipe sucessfully with negative filters ', async () => {300 const { request } = await testBedSetup.useTestBed()301 const response = await pipe(302 request('GET'),303 request.withPath('/api/recipes?search=!egg&limit=2&page=1'),304 request.send305 )306 expect(response.statusCode).toBe(200)307 expect(response.body.data).toHaveLength(1)308 })309 it('should not display recipes not published', async () => {310 const { request } = await testBedSetup.useTestBed()311 const response = await pipe(312 request('GET'),313 request.withPath('/api/recipes?search=melted+butter'),314 request.send315 )316 expect(response.statusCode).toBe(200)317 expect(response.body.data).toHaveLength(2)318 })319 it('should get recipes published with pagination', async () => {320 const { request } = await testBedSetup.useTestBed()321 const response = await pipe(322 request('GET'),323 request.withPath('/api/recipes?page=2&limit=1'),324 request.send325 )326 expect(response.statusCode).toBe(200)327 expect(response.body.data).toHaveLength(1)328 })329 it('should not get error when dont search anything', async () => {330 const { request } = await testBedSetup.useTestBed()331 const response = await pipe(332 request('GET'),333 request.withPath('/api/recipes?search=blablabla'),334 request.send335 )336 expect(response.statusCode).toBe(200)337 expect(response.body.data).toHaveLength(0)338 })339 it('should not get error when page dont have results', async () => {340 const { request } = await testBedSetup.useTestBed()341 const response = await pipe(342 request('GET'),343 request.withPath('/api/recipes?page=20'),344 request.send345 )346 expect(response.statusCode).toBe(200)347 expect(response.body.data).toHaveLength(0)348 })...

Full Screen

Full Screen

backup_v02.js

Source:backup_v02.js Github

copy

Full Screen

1const fs = require("fs");2const configfile = 'data/config/config.json'3const backuplogfile = 'data/log/backuplog.json';4const beautify = require('beautify');5(async () => {6 // back up files from multiple src directories to multiple target directories7 let backuplog_json = { files: {}, subdirs: {} }8 // read the src and target directories from the config file9 let configstr = fs.readFileSync(configfile)10 let config_json = JSON.parse(configstr)11 for (let i = 0; i < config_json.length; i++) {12 let thetask = config_json[i]13 // console.log(thetask)14 let thetasklog_json = await backup_a_src_dir(thetask.src, thetask.target)15 backuplog_json.files = { ...backuplog_json.files, ...thetasklog_json.files }16 backuplog_json.subdirs = { ...backuplog_json.subdirs, ...thetasklog_json.subdirs }17 } //for (let i=0; i < config_json.length; i++)18 console.log (23, 'saving backup log.')19 // write the updated src_dict as the backuplog20 let thetxtjson = JSON.stringify(backuplog_json)21 // console.log(thetxtjson)22 let thetxtjson_beautified = beautify(thetxtjson, { format: 'json' })23 // do not use the saveJSON function as that one saves a JSON (not jsonstr) to a .json file24 await fs.writeFileSync(backuplogfile, thetxtjson_beautified)25 console.log(31, 'done!')26})()27// a function to backup local files according to src and target dir28async function backup_a_src_dir(rootdir_src, rootdir_target) {29 let rootdir_src_norm = rootdir_src.replace(/\\/g, '/')30 // console.log(rootdir_src_norm)31 let rootdir_target_norm = rootdir_target.replace(/\\/g, '/')32 // get all files and subdirs from the src33 let src_dict = await get_files_subdirs(rootdir_src_norm)34 // console.log(src_dict)35 // loop for all filese in the src36 let keys_srcfiles = Object.keys(src_dict.files)37 console.log(46, 'total number files from src:', keys_srcfiles.length )38 for (let i = 0; i < keys_srcfiles.length; i++) {39 40 // check whether the file can be found in the target dict41 let thesrcfilename_withpath = keys_srcfiles[i]42 // get the stats of the src file43 let stats_srcfile = fs.statSync(thesrcfilename_withpath)44 console.log(55, 'Copying file ', i,'of', keys_srcfiles.length)45 console.log(56, 'Filename:', thesrcfilename_withpath, 'size', stats_srcfile.size, '...')46 // the src file name with path is like <roodir_src>/subdir/srcfile.ext47 // the corresponding file in the target dir is with the same subdir and file name, but different rootdir48 // like <roodir_target>/subdir/srcfile.ext49 // therefore, to have the target file name with path, the roodir must be substitated using the rooddir_target50 let thetargetfilename_withpath = thesrcfilename_withpath.replace(rootdir_src_norm, rootdir_target_norm)51 // console.log(31, thesrcfilename_withpath, thetargetfilename_withpath)52 src_dict.files[thesrcfilename_withpath].srcrootdir = rootdir_src_norm53 src_dict.files[thesrcfilename_withpath].targetrootdir = rootdir_target_norm54 // check if file exist in the target folder55 let targetFileExist = fs.existsSync(thetargetfilename_withpath)56 if (targetFileExist) { // if the file (corresponding to the src file) can be found in the target_dict57 // get the stats of the target file58 let stats_targetfile = fs.statSync(thetargetfilename_withpath)59 let size_changed = stats_srcfile.size === stats_targetfile.size60 let srcfile_is_newer = stats_srcfile.mtime.getTime() > stats_targetfile.mtime.getTime()61 // console.log(43, 'size changed, src file is newer:', size_changed, srcfile_is_newer)62 if (size_changed && srcfile_is_newer) { // if the src file is newer, overwrite the old file in the target folder63 // using the src file to overwrite the target file64 // console.log(45, 'file changed')65 await fs.copyFileSync(thesrcfilename_withpath, thetargetfilename_withpath)66 src_dict.files[thesrcfilename_withpath].backupstatus = 'updated'67 } else {68 // in the source dict, indicate that the same file (same size, same modified time) exists69 src_dict.files[thesrcfilename_withpath].backupstatus = 'unchanged'70 } // if (size_changed && srcfile_is_newer)71 } else { // if the correponding file cannot be found in the target path, copy the source file to the target72 // hold on, what if the src file's dir does not exist in the target path?73 // copyFileSync is stupid enough and won't create the non-existing dir!74 // get the directory of the source file75 let fullpath_srcfile = src_dict.files[thesrcfilename_withpath].fullpath76 // console.log(56, fullpath_srcfile) 77 let fullpath_targetfile = fullpath_srcfile.replace(rootdir_src_norm, rootdir_target_norm)78 // console.log(58, fullpath_targetfile) 79 // in ms windows, it is not allowed to create C:/Users/Z70/Desktop/target1/sub_180 // while its parent folder C:/Users/Z70/Desktop/target1 does not exist81 // therefore, need to check whether the parent folder exists, like82 // if C:/Users does not exist, create it first, next, if C:/Users/Z70 does not exist, create it...83 let dirExist = await fs.existsSync(fullpath_targetfile)84 if (dirExist === false) {85 await make_dir(fullpath_targetfile)86 } // if (dirExist === false) 87 await fs.copyFileSync(thesrcfilename_withpath, thetargetfilename_withpath)88 src_dict.files[thesrcfilename_withpath].backupstatus = 'created'89 } // if (target_dict[thesrcfilename_withpath])90 } // for (let i=0; i<keys_srcfiles.length; i++)91 return src_dict92}; // async function backup_a_src_dir(rootdir_src,rootdir_target )93//in ms windows, it is not allowed to create C:/Users/Z70/Desktop/target1/sub_194// while its parent folder C:/Users/Z70/Desktop/target1 does not exist95// therefore, need to check whether the parent folder exists, like96// if C:/Users does not exist, create it first, next, if C:/Users/Z70 does not exist, create it...97async function make_dir(thedir) {98 let thepath = ''99 let pathsegs = thedir.split('/')100 for (let i = 0; i < pathsegs.length; i++) {101 if (i === 0) { theseg = pathsegs[i] } else { theseg = '/' + pathsegs[i] }102 thepath = thepath + theseg103 let dirExist = await fs.existsSync(thepath)104 // console.log(72, thepath,dirExist)105 if (dirExist === false) { await fs.mkdirSync(thepath) }106 } // for (let i =0; i< pathsegs.length; i++) 107}; // async function make_dir 108// recursively get the files and subdirs within a given rootdir, save the size and last modified info109async function get_files_subdirs(thedir) {110 console.log(128, thedir)111 let result_dict = { files: {}, subdirs: {} }112 let dirExist = await fs.existsSync(thedir)113 if (dirExist) {114 let names_arr = await fs.readdirSync(thedir)115 // loop for each name (of a file or a subdir) in the dir116 console.log(134, 'number of file and subdirs:', names_arr.length)117 for (let i = 0; i < names_arr.length; i++) {118 let thename = names_arr[i]119 let thename_with_path = thedir + '/' + thename120 // get the stat of the current file/dir121 let thestat = await fs.statSync(thename_with_path)122 if (thestat.isFile()) {123 // console.log(29, thename_with_path)124 result_dict.files[thename_with_path] = {}125 result_dict.files[thename_with_path].filename = thename126 result_dict.files[thename_with_path].fullpath = thedir127 result_dict.files[thename_with_path].size = thestat.size128 result_dict.files[thename_with_path].mtime = thestat.mtime129 } else {// if it is a directory130 result_dict.subdirs[thename_with_path] = {}131 result_dict.subdirs[thename_with_path].mtime = thestat.mtime132 let thedir_subdir = thename_with_path133 let result_subdir_dict = await get_files_subdirs(thedir_subdir)134 // for the fields files and dirs respectively, merg the data in result_subdir_dict into result_subdir135 result_dict.files = { ...result_dict.files, ...result_subdir_dict.files }136 result_dict.subdirs = { ...result_dict.subdirs, ...result_subdir_dict.subdirs }137 } // if lese (isFile) 138 } // for (let i = 0; i < names_arr.length; i++)139 }//if (dirExist)140 return result_dict...

Full Screen

Full Screen

flywheel.js

Source:flywheel.js Github

copy

Full Screen

...27 }28 return `${this.url}${path}`29 }30 async login (form) {31 return axios.post(this.withPath('/v1/sessions'), form).then(r => r.data)32 }33 async logout () {34 return axios.delete(this.withPath('/v1/sessions')).then(r => r.data)35 }36 async detailSession () {37 return axios.get(this.withPath('/v1/session')).then(r => r.data)38 }39 async queryIdentity (form) {40 return axios.get(this.withPath('/me'), form).then(r => r.data)41 }42 async queryWorkflows (projectId) {43 return axios.get(this.withPath(`/v1/workflows?projectId=${projectId}`), {})44 .then(r => r.data)45 }46 async detailWorkflow (id) {47 return axios.get(this.withPath(`/v1/workflows/${id}`), {})48 .then(r => r.data)49 }50 async createWorkflow (creationForm) {51 return axios.post(this.withPath('/v1/workflows'), creationForm).then(r => r.data)52 }53 async updateWorkflowBase (id, workflowChanges) {54 return axios.put(this.withPath('/v1/workflows/' + id), workflowChanges)55 }56 async deleteWorkflow (id) {57 return axios.delete(this.withPath('/v1/workflows/' + id), {})58 }59 async loadAvailableTransitions (flowId, from) {60 return axios.get(this.withPath(`/v1/workflows/${flowId}/transitions?fromState=${from}`)).then(r => r.data)61 }62 async enableWorkflowTransition (flowId, from, to) {63 return axios.post(this.withPath(`/v1/workflows/${flowId}/transitions`), [{ name: from + '->' + to, from: from, to: to }])64 .then(r => r.data)65 }66 async disableWorkflowTransition (flowId, from, to) {67 return axios.request({68 method: 'DELETE',69 url: this.withPath(`/v1/workflows/${flowId}/transitions`),70 data: [{ name: from + '->' + to, from: from, to: to }]71 }).then(r => r.data)72 }73 async updateWorkflowState (flowId, changes) {74 return axios.put(this.withPath(`/v1/workflows/${flowId}/states`), changes)75 .then(r => r.data)76 }77 async createWorkflowState (flowId, stateCreating) {78 return axios.post(this.withPath(`/v1/workflows/${flowId}/states`), stateCreating)79 .then(r => r.data)80 }81 async updateWorkflowStateRangeOrders (flowId, orderUpdating) {82 return axios.put(this.withPath(`/v1/workflows/${flowId}/state-orders`), orderUpdating).then(r => r.data)83 }84 async createWorkTransition (flowID, workID, from, to) {85 return axios.post(this.withPath('/v1/transitions'),86 { flowId: flowID, workId: workID, fromState: from, toState: to }).then(r => r.data)87 }88 async createWorkflowProperty (flowId, requestBody) {89 return axios.post(this.withPath(`/v1/workflows/${flowId}/properties`), requestBody)90 .then(r => r.data)91 }92 async deleteWorkflowProperty (id) {93 return axios.delete(this.withPath(`/v1/workflows/properties/${id}`))94 }95 async listWorkflowPropertyDefinitions (flowId) {96 return axios.get(this.withPath(`/v1/workflows/${flowId}/properties`))97 .then(r => r.data)98 }99 async createWork (creationForm) {100 return axios.post(this.withPath('/v1/works'), creationForm).then(r => r.data)101 }102 async updateWork (id, updateData) {103 return axios.put(this.withPath('/v1/works/' + id), updateData).then(r => r.data)104 }105 async detailWork (id) {106 return axios.get(this.withPath(`/v1/works/${id}`), {})107 .then(r => r.data)108 }109 async queryWorks (projectId) {110 return axios.get(this.withPath(`/v1/works?projectId=${projectId}`), {})111 .then(r => r.data)112 }113 async queryBacklog (projectId) {114 return axios.get(this.withPath(`/v1/works?projectId=${projectId}&stateCategory=1&stateCategory=2`), {})115 .then(r => r.data)116 }117 async deleteWork (id) {118 return axios.delete(this.withPath('/v1/works/' + id), {})119 }120 async archiveWorks (idList) {121 return axios.post(this.withPath('/v1/archived-works'), { workIdList: idList }).then(r => r.data)122 }123 async updateStateRangeOrders (orderUpdating) {124 return axios.put(this.withPath('/v1/work-orders'), orderUpdating).then(r => r.data)125 }126 async queryWorkProcessSteps (workId) {127 return axios.get(this.withPath(`/v1/work-process-steps?workId=${workId}`), {})128 .then(r => r.data)129 }130 async changePassword (changes) {131 return axios.put(this.withPath('/v1/session-users/basic-auths'), changes)132 }133 async queryUsers () {134 return axios.get(this.withPath('/v1/users'), {})135 }136 async createUser (creation) {137 return axios.post(this.withPath('/v1/users'), creation).then(r => r.data)138 }139 async updateUser (userId, changes) {140 return axios.put(this.withPath('/v1/users/' + userId), changes).then(r => r.data)141 }142 async queryProjects () {143 return axios.get(this.withPath('/v1/projects'), {})144 }145 async createProject (creation) {146 return axios.post(this.withPath('/v1/projects'), creation).then(r => r.data)147 }148 async updateProject (projectId, changes) {149 return axios.put(this.withPath(`/v1/projects/${projectId}`), changes).then(r => r.data)150 }151 async queryProjectLabels (projectId, query) {152 let optionalQS = ''153 if (query) {154 optionalQS = optionalQS + '&query=' + query155 }156 return axios.get(this.withPath('/v1/labels?projectId=' + projectId + optionalQS), {}).then(r => r.data)157 }158 async addProjectLabel (creation) {159 return axios.post(this.withPath('/v1/labels'), creation)160 }161 async deleteProjectLabel (id) {162 return axios.delete(this.withPath(`/v1/labels/${id}`), {})163 }164 async addWorkCheckItem (creation) {165 return axios.post(this.withPath('/v1/checkitems'), creation)166 }167 async deleteWorkCheckItem (id) {168 return axios.delete(this.withPath(`/v1/checkitems/${id}`), {})169 }170 async updateWorkCheckItem (id, changes) {171 return axios.patch(this.withPath(`/v1/checkitems/${id}`), changes)172 }173 async queryProjectMembers (projectId) {174 return axios.get(this.withPath('/v1/project-members?projectId=' + projectId), {})175 }176 async deleteProjectMember (projectId, memberId) {177 return axios.delete(this.withPath(`/v1/project-members?projectId=${projectId}&memberId=${memberId}`), {})178 }179 async addProjectMember (creation) {180 return axios.post(this.withPath('/v1/project-members'), creation)181 }182 async queryContributions (query) {183 return axios.post(this.withPath('/v1/contributor-queries'), query).then(r => r.data)184 }185 async beginContribution (workKey, contributorId, checkitemId) {186 return axios.post(this.withPath('/v1/contributions'),187 { workKey: workKey, contributorId: contributorId, checkitemId: checkitemId || 0 })188 }189 async finishContribution (workKey, contributorId, checkitemId, effective) {190 return axios.put(this.withPath('/v1/contributions'), {191 workKey: workKey,192 contributorId: contributorId,193 checkitemId: checkitemId,194 effective: effective195 })196 }197 async addWorkLabelRelation (workId, labelId) {198 return axios.post(this.withPath('/v1/work-label-relations'), { workId: workId, labelId: labelId })199 }200 async deleteWorkLabelRelation (workId, labelId) {201 return axios.delete(this.withPath(`/v1/work-label-relations?workId=${workId}&labelId=${labelId}`), {})202 }203 async assignWorkPropertyValue (workId, name, value) {204 return axios.patch(this.withPath('/v1/work-properties'), { workId: workId, name: name, value: value })205 }206 async queryWorkPropertyValues (workId) {207 return axios.get(this.withPath(`/v1/work-properties?workId=${workId}`))208 .then(r => r.data)209 }210}211export const client = new FlywheelClient('/api')...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var frisby = require('frisby');2frisby.create('test withPath')3 .withPath('/users')4 .expectStatus(200)5 .expectHeaderContains('content-type', 'application/json')6 .expectJSONTypes('*', {7 })8.toss();9### withHeader(headerName, headerValue)10var frisby = require('frisby');11frisby.create('test withHeader')12 .withHeader('Accept', 'application/json')13 .expectStatus(200)14 .expectHeaderContains('content-type', 'application/json')15 .expectJSONTypes('*', {16 })17.toss();18### withHeaders(headers)19var frisby = require('frisby');20frisby.create('test withHeaders')21 .withHeaders({22 })23 .expectStatus(200)24 .expectHeaderContains('content-type', 'application/json')

Full Screen

Using AI Code Generation

copy

Full Screen

1var frisby = require('frisby');2frisby.create('GET request to /posts')3 .get(url + '/posts')4 .expectStatus(200)5 .expectHeaderContains('content-type', 'application/json')6 .expectJSONTypes('*', {7 })8 .expectJSON('*', {9 })10 .toss();11var frisby = require('frisby');12frisby.create('GET request to /posts')13 .get(url + '/posts')14 .expectStatus(200)15 .expectHeaderContains('content-type', 'application/json')16 .expectJSONTypes('*', {17 })18 .expectJSON('*', {19 })20 .toss();21var frisby = require('frisby');22frisby.create('GET request to /posts')23 .get(url + '/posts')24 .expectStatus(200)25 .expectHeaderContains('content-type', 'application/json')26 .expectJSONTypes('*', {27 })28 .expectJSON('*', {29 })30 .toss();31var frisby = require('frisby');32frisby.create('GET request to /posts')33 .get(url + '/posts')34 .expectStatus(200)35 .expectHeaderContains('content-type', 'application/json')36 .expectJSONTypes('*', {37 })38 .expectJSON('*', {39 })40 .toss();41var frisby = require('frisby

Full Screen

Using AI Code Generation

copy

Full Screen

1var frisby = require('frisby');2var path = require('path');3var fs = require('fs');4var path = require('path');5var util = require('util');6var async = require('async');7var request = require('request');8var FormData = require('form-data');9var form = new FormData();10var config = require('../config/config.js');11var _ = require('lodash');12var data = require('../data/data.js');13var api = require('../api/api.js');14var utils = require('../utils/utils.js');15var url = require('url');16var querystring = require('querystring');17var config = require('../config/config.js');18var data = require('../data/data.js');19var api = require('../api/api.js');20var utils = require('../utils/utils.js');21var url = require('url');22var querystring = require('querystring');23var config = require('../config/config.js');24var data = require('../data/data.js');25var api = require('../api/api.js');26var utils = require('../utils/utils.js');27var url = require('url');28var querystring = require('querystring');29var config = require('../config/config.js');30var data = require('../data/data.js');31var api = require('../api/api.js');32var utils = require('../utils/utils.js');33var url = require('url');34var querystring = require('querystring');35var config = require('../config/config.js');36var data = require('../data/data.js');37var api = require('../api/api.js');38var utils = require('../utils/utils.js');39var url = require('url');40var querystring = require('querystring');41var config = require('../config/config.js');42var data = require('../data/data.js');43var api = require('../api/api.js');44var utils = require('../utils/utils.js');45var url = require('url');46var querystring = require('querystring');47var config = require('../config/config.js');48var data = require('../data/data.js');49var api = require('../api/api.js');50var utils = require('../utils/utils.js');51var url = require('url');52var querystring = require('querystring');53var config = require('../config/config.js');54var data = require('../data/data.js');55var api = require('../api/api.js');56var utils = require('../utils/utils.js');57var url = require('url');58var querystring = require('querystring');59var config = require('../config/config.js

Full Screen

Using AI Code Generation

copy

Full Screen

1var frisby = require('frisby');2var fs = require('fs');3var data = fs.readFileSync('test.json');4var dataJson = JSON.parse(data);5frisby.create('Test GET')6 .get(dataJson.url)7 .expectStatus(200)8 .expectHeaderContains('content-type', 'application/json')9 .expectJSON(dataJson.body)10 .toss();11{12 "body": {13 "args": {},14 "headers": {15 "Accept-Language": "en-US,en;q=0.8",16 },

Full Screen

Using AI Code Generation

copy

Full Screen

1var frisby = require('frisby');2var path = '/users';3var id = '/1';4var id2 = '/2';5var id3 = '/3';6var id4 = '/4';7var id5 = '/5';8var id6 = '/6';9var id7 = '/7';10var id8 = '/8';11var id9 = '/9';12var id10 = '/10';13var id11 = '/11';14var id12 = '/12';15var id13 = '/13';16var id14 = '/14';17var id15 = '/15';18var id16 = '/16';19var id17 = '/17';20var id18 = '/18';21var id19 = '/19';22var id20 = '/20';23var id21 = '/21';24var id22 = '/22';25var id23 = '/23';26var id24 = '/24';27var id25 = '/25';28var id26 = '/26';29var id27 = '/27';30var id28 = '/28';31var id29 = '/29';32var id30 = '/30';33var id31 = '/31';34var id32 = '/32';35var id33 = '/33';36var id34 = '/34';37var id35 = '/35';38var id36 = '/36';39var id37 = '/37';40var id38 = '/38';41var id39 = '/39';42var id40 = '/40';43var id41 = '/41';44var id42 = '/42';45var id43 = '/43';46var id44 = '/44';47var id45 = '/45';48var id46 = '/46';49var id47 = '/47';50var id48 = '/48';51var id49 = '/49';52var id50 = '/50';53var id51 = '/51';54var id52 = '/52';55var id53 = '/53';56var id54 = '/54';57var id55 = '/55';58var id56 = '/56';59var id57 = '/57';60var id58 = '/58';61var id59 = '/59';62var id60 = '/60';63var id61 = '/61';64var id62 = '/62';65var id63 = '/63';66var id64 = '/64';67var id65 = '/65';68var id66 = '/66';

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run frisby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful