How to use expectedPath method in stryker-parent

Best JavaScript code snippet using stryker-parent

AccountingAPI-endpoint.tests.ts

Source:AccountingAPI-endpoint.tests.ts Github

copy

Full Screen

1import { XeroClientConfiguration } from '../internals/BaseAPIClient';2import { OAuth1HttpClient } from '../internals/OAuth1HttpClient';3import { AccountingAPIClient } from '../AccountingAPIClient';4import { mapState, mapConfig } from '../internals/config-helper';5import { validTestCertPath } from '../internals/__tests__/helpers/privateKey-helpers';6import { InMemoryOAuthLibFactoryFactory } from '../internals/__tests__/helpers/InMemoryOAuthLib';7import { IFixture, IEndPointDetails } from './helpers/IFixture';8describe('AccountingAPI endpoints', () => {9 const guid1 = 'dcb417fc-0c23-4ba3-bc7f-fbc718e7e663';10 const guid2 = '857c9e3f-640a-4df2-99fd-dd0e52a785e7';11 const xeroConfig: XeroClientConfiguration = {12 appType: 'private',13 consumerKey: 'RDGDV41TRLQZDFSDX96TKQ2KRJIW4C',14 consumerSecret: 'DJ3CMGDB0DIIA9DNEEJMRLZG0BWE7Y',15 privateKeyPath: validTestCertPath()16 };17 const inMemoryOAuthLibFF = new InMemoryOAuthLibFactoryFactory();18 const oauthConfig = mapConfig(xeroConfig, { apiBasePath: '/api.xro/2.0/' });19 const accountingBaseUrl = oauthConfig.apiBaseUrl;20 const oauthHttpClient = new OAuth1HttpClient(oauthConfig, mapState(xeroConfig), inMemoryOAuthLibFF.newFactory());21 const xeroClient = new AccountingAPIClient(xeroConfig, null, oauthHttpClient);22 const actionToVerbMap: { [key: string]: string } = {23 create: 'put',24 delete: 'delete',25 update: 'post',26 get: 'get'27 };28 const fixtures: IFixture = {29 accounts: [30 { action: 'get', expectedPath: 'accounts' },31 { action: 'get', expectedPath: `accounts/${guid1}?order=TaxType`, args: { AccountID: guid1, order: 'TaxType' } },32 { action: 'create', expectedPath: `accounts` },33 { action: 'update', expectedPath: `accounts/${guid1}`, args: { AccountID: guid1 } },34 { action: 'delete', expectedPath: `accounts/${guid1}`, args: { AccountID: guid1 } },35 { subResource: 'attachments', action: 'get', expectedPath: `accounts/${guid1}/attachments`, args: { entityId: guid1 } }36 ],37 bankTransactions: [38 { action: 'get', expectedPath: 'banktransactions' },39 { action: 'get', expectedPath: `banktransactions?page=3`, args: { page: 3 } },40 { action: 'get', expectedPath: `banktransactions/${guid1}`, args: { BankTransactionID: guid1 } },41 { action: 'get', expectedPath: `banktransactions?order=something`, args: { order: 'something' } },42 { action: 'get', expectedPath: `banktransactions?where=Type%3D%3D%22ACCPAY%22&createdByMyApp=true`, args: { where: `Type=="ACCPAY"`, createdByMyApp: true } },43 { action: 'get', expectedPath: `banktransactions?page=3`, args: { 'page': 3, 'If-Modified-Since': 'headerValue' } },44 { action: 'get', expectedPath: `banktransactions?page=3&unitdp=4`, args: { page: 3, unitdp: 4 } },45 { action: 'create', expectedPath: 'banktransactions?summarizeErrors=false' },46 { action: 'update', expectedPath: 'banktransactions?summarizeErrors=false' },47 { action: 'update', expectedPath: 'banktransactions?summarizeErrors=true', args: { summarizeErrors: true } }48 ],49 bankTransfers: [50 { action: 'get', expectedPath: 'banktransfers' },51 { action: 'get', expectedPath: `banktransfers/${guid1}`, args: { BankTransferID: guid1 } },52 { action: 'get', expectedPath: `banktransfers?where=Type%3D%3D%22BANK%22`, args: { where: 'Type=="BANK"' } },53 { action: 'get', expectedPath: 'banktransfers' },54 { action: 'create', expectedPath: `banktransfers?summarizeErrors=false` },55 { subResource: 'attachments', action: 'get', expectedPath: `banktransfers/${guid1}/attachments`, args: { entityId: guid1 } }56 ],57 brandingThemes: [58 { action: 'get', expectedPath: 'brandingthemes' },59 { action: 'get', expectedPath: `brandingthemes/${guid1}`, args: { BrandingThemeID: guid1 } },60 ],61 contactGroups: [62 { action: 'get', expectedPath: 'contactgroups' },63 { action: 'get', expectedPath: 'contactgroups?where=Type%3D%3D%22BANK%22', args: { where: 'Type=="BANK"' } },64 { action: 'get', expectedPath: 'contactgroups?order=EmailAddress%20DESC', args: { order: 'EmailAddress DESC' } },65 { action: 'create', expectedPath: 'contactgroups?summarizeErrors=false' },66 { action: 'update', expectedPath: `contactgroups/${guid1}?summarizeErrors=false`, args: { ContactGroupID: guid1 } },67 { action: 'update', expectedPath: `contactgroups?summarizeErrors=false` },68 { subResource: 'contacts', action: 'create', expectedPath: `contactgroups/${guid1}/contacts?summarizeErrors=false`, args: { ContactGroupID: guid1 } },69 { subResource: 'contacts', action: 'delete', expectedPath: `contactgroups/${guid1}/contacts/${guid2}?summarizeErrors=false`, args: { ContactGroupID: guid1, ContactID: guid2 } },70 { subResource: 'contacts', action: 'delete', expectedPath: `contactgroups/${guid1}/contacts?summarizeErrors=false`, args: { ContactGroupID: guid1 } },71 ],72 contacts: [73 { action: 'get', expectedPath: 'contacts' },74 { action: 'get', expectedPath: `contacts/${guid1}`, args: { ContactID: guid1 } },75 { action: 'get', expectedPath: `contacts?IDs=${guid1}%2C${guid2}`, args: { IDs: `${guid1},${guid2}` } },76 { action: 'get', expectedPath: `contacts?where=Type%3D%3D%22BANK%22`, args: { where: 'Type=="BANK"' } },77 { action: 'get', expectedPath: `contacts?order=EmailAddress%20DESC`, args: { order: 'EmailAddress DESC' } },78 { action: 'get', expectedPath: `contacts?includeArchived=true`, args: { includeArchived: true } },79 { action: 'get', expectedPath: `contacts`, args: { 'If-Modified-Since': 'headerValue' } },80 { action: 'get', expectedPath: `contacts?where=Type%3D%3D%22BANK%22`, args: { where: 'Type=="BANK"' } },81 { action: 'get', expectedPath: `contacts?order=EmailAddress%20DESC`, args: { order: 'EmailAddress DESC' } },82 { action: 'get', expectedPath: `contacts?page=2`, args: { page: 2 } },83 { subResource: 'CISsettings', action: 'get', expectedPath: `contacts/${guid1}/cissettings`, args: { ContactID: guid1 } },84 { action: 'update', expectedPath: `contacts/${guid1}?summarizeErrors=false`, args: { ContactID: guid1 } },85 { action: 'update', expectedPath: `contacts/${guid1}?summarizeErrors=true`, args: { summarizeErrors: true, ContactID: guid1 } },86 { action: 'create', expectedPath: `contacts?summarizeErrors=false` },87 { action: 'create', expectedPath: `contacts?summarizeErrors=true`, args: { summarizeErrors: true } },88 ],89 creditNotes: [90 { action: 'get', expectedPath: 'creditnotes' },91 { subResource: 'allocations', action: 'create', expectedPath: `creditnotes/${guid1}/allocations`, args: { CreditNoteID: guid1 } },92 { action: 'get', expectedPath: `creditnotes/${'CRE-123'}`, args: { CreditNoteNumber: 'CRE-123' } },93 { action: 'get', expectedPath: `creditnotes?page=3`, args: { page: 3 } },94 { action: 'get', expectedPath: `creditnotes?order=something`, args: { order: 'something' } },95 { action: 'get', expectedPath: `creditnotes?where=Type%3D%3D%22ACCPAY%22&createdByMyApp=true`, args: { where: `Type=="ACCPAY"`, createdByMyApp: true } },96 { action: 'get', expectedPath: `creditnotes?page=3`, args: { 'page': 3, 'If-Modified-Since': 'headerValue' } },97 { action: 'create', expectedPath: 'creditnotes?summarizeErrors=false' },98 { action: 'update', expectedPath: 'creditnotes?summarizeErrors=false' },99 { action: 'update', expectedPath: 'creditnotes?summarizeErrors=true', args: { summarizeErrors: true } }100 ],101 currencies: [102 { action: 'get', expectedPath: `currencies` },103 { action: 'get', expectedPath: `currencies?where=Type%3D%3D%22BANK%22`, args: { where: 'Type=="BANK"' } },104 { action: 'get', expectedPath: `currencies?order=EmailAddress%20DESC`, args: { order: 'EmailAddress DESC' } },105 { action: 'create', expectedPath: `currencies` },106 ],107 employees: [108 { action: 'get', expectedPath: 'employees' },109 { action: 'get', expectedPath: `employees/${guid1}`, args: { EmployeeID: guid1 } },110 { action: 'get', expectedPath: `employees?where=Type%3D%3D%22BANK%22`, args: { where: 'Type=="BANK"' } },111 { action: 'get', expectedPath: `employees?order=EmailAddress%20DESC`, args: { order: 'EmailAddress DESC' } },112 { action: 'get', expectedPath: `employees`, args: { 'If-Modified-Since': 'headerValue' } },113 { action: 'create', expectedPath: 'employees' },114 { action: 'update', expectedPath: 'employees' }115 ],116 expenseClaims: [117 { action: 'get', expectedPath: 'expenseclaims' },118 { action: 'get', expectedPath: `expenseclaims/${guid1}`, args: { ExpenseClaimID: guid1 } },119 { action: 'get', expectedPath: `expenseclaims?order=Status`, args: { order: 'Status' } },120 { action: 'create', expectedPath: `expenseclaims?summarizeErrors=false` },121 { action: 'update', expectedPath: `expenseclaims?summarizeErrors=false` },122 { action: 'update', expectedPath: `expenseclaims/${guid1}?summarizeErrors=false`, args: { ExpenseClaimID: guid1 } },123 { action: 'update', expectedPath: `expenseclaims/${guid1}?summarizeErrors=true`, args: { ExpenseClaimID: guid1, summarizeErrors: true } },124 ],125 invoiceReminders: [126 { action: 'get', expectedPath: 'invoicereminders/settings' },127 ],128 invoices: [129 { action: 'get', expectedPath: 'invoices' },130 { action: 'get', expectedPath: `invoices/${guid1}`, args: { InvoiceID: guid1 } },131 { action: 'get', expectedPath: `invoices/${'INV-123'}`, args: { InvoiceNumber: 'INV-123' } },132 { action: 'get', expectedPath: `invoices/${guid1}?createdByMyApp=true`, args: { InvoiceID: guid1, createdByMyApp: true } },133 { action: 'get', expectedPath: `invoices?where=Type%3D%3D%22ACCPAY%22`, args: { where: `Type=="ACCPAY"` } },134 { action: 'get', expectedPath: `invoices?where=Type%3D%3D%22ACCPAY%22&createdByMyApp=true`, args: { where: `Type=="ACCPAY"`, createdByMyApp: true } },135 { action: 'get', expectedPath: `invoices?Statuses=DRAFT%2CSUBMITTED`, args: { Statuses: 'DRAFT,SUBMITTED' } },136 { action: 'get', expectedPath: `invoices?order=something`, args: { order: 'something' } },137 { action: 'get', expectedPath: `invoices?page=3`, args: { page: 3 } },138 { action: 'get', expectedPath: `invoices?page=3`, args: { 'page': 3, 'If-Modified-Since': 'headerValue' } },139 { action: 'get', expectedPath: `invoices?createdByMyApp=true&where=Type%3D%3D%22ACCREC%22&page=5&Statuses=DELETED`, args: { createdByMyApp: true, where: `Type=="ACCREC"`, page: 5, Statuses: 'DELETED' } },140 { subResource: 'attachments', action: 'get', expectedPath: `invoices/${guid1}/attachments`, args: { entityId: guid1 } },141 { subResource: 'onlineInvoice', action: 'get', expectedPath: `invoices/${guid1}/onlineinvoice`, args: { InvoiceID: guid1 } },142 { action: 'create', expectedPath: 'invoices?summarizeErrors=false' },143 { action: 'update', expectedPath: `invoices/${guid1}?summarizeErrors=false`, args: { InvoiceID: guid1 } },144 { action: 'update', expectedPath: `invoices?summarizeErrors=false` },145 { action: 'update', expectedPath: `invoices/${'INV-123'}?summarizeErrors=false`, args: { InvoiceNumber: 'INV-123' } },146 { action: 'update', expectedPath: `invoices/${'INV-123'}?summarizeErrors=true`, args: { InvoiceNumber: 'INV-123', summarizeErrors: true } },147 { action: 'update', expectedPath: `invoices/${'INV-123'}?summarizeErrors=true`, args: { summarizeErrors: true, InvoiceNumber: 'INV-123' } },148 // { action: 'savePDF', expectedPath: `invoices/${guid1}`, args: { InvoiceID: guid1, savePath: '/dev/null'} },149 // { action: 'savePDF', expectedPath: `invoices/${'INV-123'}`, args: { InvoiceNumber: 'INV-123', savePath: '/dev/null' } },150 ],151 items: [152 { action: 'get', expectedPath: 'items' },153 { action: 'get', expectedPath: `items/${guid1}`, args: { ItemID: guid1 } },154 { action: 'get', expectedPath: `items/${guid1}?order=UpdatedDateUTC`, args: { ItemID: guid1, order: 'UpdatedDateUTC' } },155 { action: 'create', expectedPath: `items?summarizeErrors=false` },156 { action: 'update', expectedPath: `items?summarizeErrors=false` },157 { action: 'update', expectedPath: `items/${guid1}?summarizeErrors=true`, args: { ItemID: guid1, summarizeErrors: true } },158 ],159 journals: [160 { action: 'get', expectedPath: 'journals' },161 { action: 'get', expectedPath: `journals/${guid1}`, args: { Recordfilter: guid1 } },162 { action: 'get', expectedPath: `journals?offset=2`, args: { offset: '2' } },163 { action: 'get', expectedPath: `journals?paymentsOnly=true`, args: { paymentsOnly: true } },164 { action: 'get', expectedPath: `journals`, args: { 'If-Modified-Since': 'headerValue' } },165 ],166 linkedTransactions: [167 { action: 'get', expectedPath: 'linkedtransactions' },168 { action: 'get', expectedPath: `linkedtransactions/${guid1}`, args: { LinkedTransactionID: guid1 } },169 { action: 'get', expectedPath: `linkedtransactions/${guid1}`, args: { LinkedTransactionID: guid1 } },170 { action: 'get', expectedPath: `linkedtransactions?page=3`, args: { page: 3 } },171 { action: 'get', expectedPath: `linkedtransactions?SourceTransactionID=${guid1}`, args: { SourceTransactionID: guid1 } },172 { action: 'get', expectedPath: `linkedtransactions?ContactID=${guid1}`, args: { ContactID: guid1 } },173 { action: 'get', expectedPath: `linkedtransactions?Status=${guid1}`, args: { Status: guid1 } },174 { action: 'get', expectedPath: `linkedtransactions?TargetTransactionID=${guid1}`, args: { TargetTransactionID: guid1 } },175 { action: 'get', expectedPath: `linkedtransactions?unitdp=4`, args: { unitdp: 4 } },176 { action: 'create', expectedPath: 'linkedtransactions?summarizeErrors=false' },177 { action: 'update', expectedPath: 'linkedtransactions?summarizeErrors=false' },178 { action: 'update', expectedPath: `linkedtransactions/${guid1}?summarizeErrors=false`, args: { LinkedTransactionID: guid1 } },179 { action: 'update', expectedPath: 'linkedtransactions?summarizeErrors=true', args: { summarizeErrors: true } },180 { action: 'delete', expectedPath: `linkedtransactions/${guid1}`, args: { LinkedTransactionID: guid1 } }181 ],182 manualJournals: [183 { action: 'get', expectedPath: 'manualjournals' },184 { action: 'get', expectedPath: `manualjournals/${guid1}`, args: { ManualJournalID: guid1 } },185 { action: 'get', expectedPath: `manualjournals/${guid1}?order=UpdatedDateUTC`, args: { ManualJournalID: guid1, order: 'UpdatedDateUTC' } },186 { action: 'get', expectedPath: `manualjournals?page=3`, args: { 'page': 3, 'If-Modified-Since': 'headerValue' } },187 { action: 'create', expectedPath: `manualjournals?summarizeErrors=false` },188 { action: 'update', expectedPath: `manualjournals?summarizeErrors=false` },189 { action: 'update', expectedPath: `manualjournals/${guid1}?summarizeErrors=true`, args: { ManualJournalID: guid1, summarizeErrors: true } },190 { subResource: 'attachments', action: 'get', expectedPath: `manualjournals/${guid1}/attachments`, args: { entityId: guid1 } },191 ],192 organisations: [193 { action: 'get', expectedPath: 'organisations' },194 { subResource: 'CISSettings', action: 'get', expectedPath: `organisations/${guid1}/CISSettings`, args: { OrganisationID: guid1 } }195 ],196 overpayments: [197 { action: 'get', expectedPath: 'overpayments' },198 { action: 'get', expectedPath: `overpayments/${guid1}?order=Date`, args: { OverpaymentID: guid1, order: 'Date' } },199 { action: 'get', expectedPath: `overpayments?page=5`, args: { page: 5 }},200 { subResource: 'allocations', action: 'create', expectedPath: `overpayments/${guid1}/allocations`, args: { OverpaymentID: guid1 } }201 ],202 payments: [203 { action: 'get', expectedPath: 'payments' },204 { action: 'get', expectedPath: `payments/${guid1}`, args: { PaymentID: guid1 } },205 { action: 'get', expectedPath: `payments/${guid1}?order=UpdatedDateUTC`, args: { PaymentID: guid1, order: 'UpdatedDateUTC' } },206 { action: 'get', expectedPath: `payments`, args: { 'If-Modified-Since': 'headerValue' } },207 { action: 'create', expectedPath: `payments?summarizeErrors=false` },208 { action: 'update', expectedPath: `payments?summarizeErrors=false` },209 { action: 'update', expectedPath: `payments/${guid1}?summarizeErrors=true`, args: { PaymentID: guid1, summarizeErrors: true } },210 ],211 prepayments: [212 { action: 'get', expectedPath: 'prepayments' },213 { action: 'get', expectedPath: `prepayments/${guid1}`, args: { PrepaymentID: guid1 } },214 { action: 'get', expectedPath: `prepayments/${guid1}?order=UpdatedDateUTC`, args: { PrepaymentID: guid1, order: 'UpdatedDateUTC' } },215 { action: 'get', expectedPath: `prepayments?page=5`, args: { 'page': 5, 'If-Modified-Since': 'headerValue' } },216 { subResource: 'allocations', action: 'create', expectedPath: `prepayments/${guid1}/allocations`, args: { PrepaymentID: guid1 } },217 { subResource: 'attachments', action: 'get', expectedPath: `prepayments/${guid1}/attachments`, args: { entityId: guid1 } },218 ],219 purchaseOrders: [220 { action: 'get', expectedPath: 'purchaseorders' },221 { action: 'get', expectedPath: `purchaseorders/${guid1}`, args: { PurchaseOrderID: guid1 } },222 { action: 'get', expectedPath: `purchaseorders/${'PO-123'}`, args: { PurchaseOrderNumber: 'PO-123' } },223 { action: 'get', expectedPath: `purchaseorders/${guid1}?order=UpdatedDateUTC`, args: { PurchaseOrderID: guid1, order: 'UpdatedDateUTC' } },224 { action: 'get', expectedPath: `purchaseorders`, args: { 'If-Modified-Since': 'headerValue' } },225 { action: 'create', expectedPath: `purchaseorders?summarizeErrors=false` },226 { action: 'update', expectedPath: `purchaseorders?summarizeErrors=false` },227 { action: 'update', expectedPath: `purchaseorders/${guid1}?summarizeErrors=true`, args: { PurchaseOrderID: guid1, summarizeErrors: true } },228 // { action: 'savePDF', expectedPath: `purchaseorders/${guid1}`, args: { InvoiceID: guid1, savePath: '/dev/null'} },229 // { action: 'savePDF', expectedPath: `purchaseorders/${'PO-123'}`, args: { InvoiceNumber: 'PO-123', savePath: '/dev/null' } },230 ],231 receipts: [232 { action: 'get', expectedPath: 'receipts' },233 { action: 'get', expectedPath: `receipts/${guid1}`, args: { ReceiptID: guid1 } },234 { action: 'get', expectedPath: `receipts/${guid1}?order=UpdatedDateUTC`, args: { ReceiptID: guid1, order: 'UpdatedDateUTC' } },235 { action: 'get', expectedPath: `receipts?order=UpdatedDateUTC`, args: { 'order': 'UpdatedDateUTC', 'If-Modified-Since': 'headerValue' } },236 { action: 'create', expectedPath: 'receipts?summarizeErrors=false' },237 { action: 'update', expectedPath: `receipts?summarizeErrors=true`, args: { summarizeErrors: true } },238 { action: 'update', expectedPath: `receipts/${guid1}?summarizeErrors=false`, args: { ReceiptID: guid1 } },239 { subResource: 'attachments', action: 'get', expectedPath: `receipts/${guid1}/attachments`, args: { entityId: guid1 } },240 ],241 repeatingInvoices: [242 { action: 'get', expectedPath: 'repeatinginvoices' },243 { action: 'get', expectedPath: `repeatinginvoices/${guid1}`, args: { RepeatingInvoiceID: guid1 } },244 { action: 'get', expectedPath: 'repeatinginvoices?where=Status%3D%3D%22DRAFT%22', args: { where: 'Status=="DRAFT"' } },245 { action: 'get', expectedPath: 'repeatinginvoices?order=Name%20DESC', args: { order: 'Name DESC' } },246 ],247 reports: [248 { action: 'get', expectedPath: 'reports' },249 { action: 'get', expectedPath: `reports/${guid1}`, args: { ReportID: guid1 } },250 { action: 'get', expectedPath: 'reports/TrialBalance', args: { ReportID: 'TrialBalance' } },251 { action: 'get', expectedPath: 'reports/TenNinetyNine?reportYear=2013', args: { ReportID: 'TenNinetyNine', reportYear: 2013 } },252 { action: 'get', expectedPath: 'reports/ProfitAndLoss?fromDate=2010-01-01&toDate=2011-01-01', args: { ReportID: 'ProfitAndLoss', fromDate: '2010-01-01', toDate: '2011-01-01' } }253 ],254 // TODO taxRates255 trackingCategories: [256 { action: 'get', expectedPath: 'trackingcategories' },257 { action: 'get', expectedPath: 'trackingcategories?where=Status%3D%3D%22ACTIVE%22', args: { where: 'Status=="ACTIVE"' } },258 { action: 'get', expectedPath: 'trackingcategories?order=Name%20DESC', args: { order: 'Name DESC' } },259 { action: 'create', expectedPath: 'trackingcategories' },260 { action: 'update', expectedPath: `trackingcategories/${guid1}`, args: { TrackingCategoryID: guid1 } },261 { action: 'delete', expectedPath: `trackingcategories/${guid1}`, args: { TrackingCategoryID: guid1 } },262 { subResource: 'trackingOptions', action: 'create', expectedPath: `trackingcategories/${guid1}/Options`, args: { TrackingCategoryID: guid1 } },263 { subResource: 'trackingOptions', action: 'update', expectedPath: `trackingcategories/${guid1}/Options/${guid2}`, args: { TrackingCategoryID: guid1, TrackingOptionID: guid2 } },264 { subResource: 'trackingOptions', action: 'delete', expectedPath: `trackingcategories/${guid1}/Options/${guid2}`, args: { TrackingCategoryID: guid1, TrackingOptionID: guid2 } }265 ],266 users: [267 { action: 'get', expectedPath: 'users' },268 { action: 'get', expectedPath: `users/${guid1}`, args: { UserID: guid1 } },269 { action: 'get', expectedPath: `users?where=IsSubscriber%3D%3Dtrue`, args: { where: 'IsSubscriber==true' } },270 { action: 'get', expectedPath: `users?order=EmailAddress%20DESC`, args: { order: 'EmailAddress DESC' } },271 { action: 'get', expectedPath: `users`, args: { 'If-Modified-Since': 'headerValue' } },272 ]273 };274 Object.keys(fixtures).map((endpoint: string) => {275 (fixtures[endpoint]).map((fixture: IEndPointDetails) => {276 describe(`${endpoint} ${fixture.subResource || ''}.${fixture.action}(${fixture.args ? Object.keys(fixture.args) : ''})`, () => {277 let result: any;278 const mockedResponse = JSON.stringify({ a: 'response' });279 const hasRequestBody = (fixture.action == 'create' || fixture.action == 'update');280 const mockedRequestBody = hasRequestBody ? { a: 'request' } : null;281 beforeAll(async () => {282 inMemoryOAuthLibFF.inMemoryOAuthLib.reset();283 inMemoryOAuthLibFF.inMemoryOAuthLib.setResponse(false, mockedResponse, { statusCode: 200 });284 if (fixture.subResource) {285 mockedRequestBody286 ? result = await (xeroClient as any)[endpoint][fixture.subResource][fixture.action](mockedRequestBody, fixture.args)287 : result = await (xeroClient as any)[endpoint][fixture.subResource][fixture.action](fixture.args);288 } else {289 mockedRequestBody290 ? result = await (xeroClient as any)[endpoint][fixture.action](mockedRequestBody, fixture.args)291 : result = await (xeroClient as any)[endpoint][fixture.action](fixture.args);292 }293 });294 it(`calls the ${fixture.expectedPath} endpoint`, () => {295 inMemoryOAuthLibFF.inMemoryOAuthLib.lastCalledThisURL(accountingBaseUrl + '/api.xro/2.0/' + fixture.expectedPath);296 });297 it(`calls the ${actionToVerbMap[fixture.action]} verb`, () => {298 inMemoryOAuthLibFF.inMemoryOAuthLib.lastCalledThisMethod(actionToVerbMap[fixture.action]);299 });300 if (fixture.args && fixture.args.headers) {301 it(`calls with expected headers`, () => {302 inMemoryOAuthLibFF.inMemoryOAuthLib.lastHadThisHeader(fixture.args.headers);303 });304 }305 it('requested with expected body', () => {306 inMemoryOAuthLibFF.inMemoryOAuthLib.lastRequestedHadBody(mockedRequestBody);307 });308 it('matches the expected response', () => {309 expect(result).toMatchObject(JSON.parse(mockedResponse));310 });311 });312 });313 });...

Full Screen

Full Screen

normalize-folder-path.spec.js

Source:normalize-folder-path.spec.js Github

copy

Full Screen

1// jest.mock('os', () => ({2// currentPlatform: 'win32',3// platform: () => this.currentPlatform,4// setCurrentPlatform: (p) => { this.currentPlatform = p; }5// }))6const path = require('path');7const normalizeFolderPath = require('../normalize-folder-path');8const os = require('os');9const platforms = {10 win32: 'win32',11 mac: 'darwin',12 linux: 'linux'13};14const currentPlatform = os.platform();15describe('Tests for windows platform', () => {16 if (os.platform() != platforms.win32) {17 return;18 }19 test('Folder path starts with file:/', () => {20 const folderPath = 'file:/c:\\src\\localFile.txt';21 const normalizedPath = normalizeFolderPath(folderPath);22 const expectedPath = path.normalize('c:/src/localFile.txt');23 expect(normalizedPath).toBe(expectedPath);24 });25 test('Folder path starts with file://', () => {26 const folderPath = 'file://c:\\src\\localFile.txt';27 const normalizedPath = normalizeFolderPath(folderPath);28 const expectedPath = path.normalize('c:/src/localFile.txt');29 expect(normalizedPath).toBe(expectedPath);30 });31 test('Folder path starts with file:///', () => {32 const folderPath = 'file:///c:\\src\\localFile.txt';33 const normalizedPath = normalizeFolderPath(folderPath);34 const expectedPath = path.normalize('c:/src/localFile.txt');35 expect(normalizedPath).toBe(expectedPath);36 });37 test('Folder path starts with /', () => {38 const folderPath = 'file:///dev/src/localFile.txt';39 const normalizedPath = normalizeFolderPath(folderPath);40 const expectedPath = path.normalize('dev/src/localFile.txt');41 expect(normalizedPath).toBe(expectedPath);42 });43 test('Folder path starts with /./', () => {44 const folderPath = 'file:///./dev/src/localFile.txt';45 const normalizedPath = normalizeFolderPath(folderPath);46 const expectedPath = path.normalize('dev\\src\\localFile.txt');47 expect(normalizedPath).toBe(expectedPath);48 });49 test('Folder path starts with ~', () => {50 const folderPath = 'file://~dev/src/localFile.txt';51 const normalizedPath = normalizeFolderPath(folderPath);52 const expectedPath = path.normalize('~dev\\src\\localFile.txt');53 expect(normalizedPath).toBe(expectedPath);54 });55});56describe('Tests for linux platform', () => {57 if (os.platform() != platforms.linux) {58 return;59 }60 test('Folder path starts with file:/', () => {61 const folderPath = 'file://dev/src/localFile.txt';62 const normalizedPath = normalizeFolderPath(folderPath);63 const expectedPath = path.normalize('/dev/src/localFile.txt');64 expect(normalizedPath).toBe(expectedPath);65 });66 test('Folder path starts with file://', () => {67 const folderPath = 'file:///dev/src/localFile.txt';68 const normalizedPath = normalizeFolderPath(folderPath);69 const expectedPath = path.normalize('/dev/src/localFile.txt');70 expect(normalizedPath).toBe(expectedPath);71 });72 test('Folder path starts with file:///', () => {73 const folderPath = 'file:////dev/src/localFile.txt';74 const normalizedPath = normalizeFolderPath(folderPath);75 const expectedPath = path.normalize('/dev/src/localFile.txt');76 expect(normalizedPath).toBe(expectedPath);77 });78 test('Folder path starts with /', () => {79 const folderPath = '/dev/src/localFile.txt';80 const normalizedPath = normalizeFolderPath(folderPath);81 const expectedPath = path.normalize('/dev/src/localFile.txt');82 expect(normalizedPath).toBe(expectedPath);83 });84 test('Folder path starts with ./', () => {85 const folderPath = './dev/src/localFile.txt';86 const normalizedPath = normalizeFolderPath(folderPath);87 const expectedPath = path.normalize('dev/src/localFile.txt');88 expect(normalizedPath).toBe(expectedPath);89 });90 test('Folder path starts with ~', () => {91 const folderPath = '~/dev/src/localFile.txt';92 const normalizedPath = normalizeFolderPath(folderPath);93 const expectedPath = path.normalize('~/dev/src/localFile.txt');94 expect(normalizedPath).toBe(expectedPath);95 });96});97describe('Tests for mac platform', () => {98 if (os.platform() != platforms.mac) {99 return;100 }101 test('Folder path starts with file:/', () => {102 const folderPath = 'file://dev/src/localFile.txt';103 const normalizedPath = normalizeFolderPath(folderPath);104 const expectedPath = path.normalize('/dev/src/localFile.txt');105 expect(normalizedPath).toBe(expectedPath);106 });107 test('Folder path starts with file://', () => {108 const folderPath = 'file:///dev/src/localFile.txt';109 const normalizedPath = normalizeFolderPath(folderPath);110 const expectedPath = path.normalize('/dev/src/localFile.txt');111 expect(normalizedPath).toBe(expectedPath);112 });113 test('Folder path starts with file:///', () => {114 const folderPath = 'file:////dev/src/localFile.txt';115 const normalizedPath = normalizeFolderPath(folderPath);116 const expectedPath = path.normalize('/dev/src/localFile.txt');117 expect(normalizedPath).toBe(expectedPath);118 });119 test('Folder path starts with /', () => {120 const folderPath = '/dev/src/localFile.txt';121 const normalizedPath = normalizeFolderPath(folderPath);122 const expectedPath = path.normalize('/dev/src/localFile.txt');123 expect(normalizedPath).toBe(expectedPath);124 });125 test('Folder path starts with ./', () => {126 const folderPath = './dev/src/localFile.txt';127 const normalizedPath = normalizeFolderPath(folderPath);128 const expectedPath = path.normalize('dev/src/localFile.txt');129 expect(normalizedPath).toBe(expectedPath);130 });131 test('Folder path starts with ~', () => {132 const folderPath = '~/dev/src/localFile.txt';133 const normalizedPath = normalizeFolderPath(folderPath);134 const expectedPath = path.normalize('~/dev/src/localFile.txt');135 expect(normalizedPath).toBe(expectedPath);136 });...

Full Screen

Full Screen

getFilePath.test.js

Source:getFilePath.test.js Github

copy

Full Screen

1import getFilePath from '../../src/utils/getFilePath'2import path from 'path'3describe('getFilePath', () => {4 let basePath = null5 let defaultFilename = null6 beforeAll(() => {7 basePath = process.cwd()8 defaultFilename = 'appium-standalone.txt'9 })10 test('should handle dir "./"', () => {11 const dir = './'12 const expectedPath = path.join(basePath, defaultFilename)13 const filePath = getFilePath(dir, defaultFilename)14 expect(filePath).toBe(expectedPath)15 })16 test('should handle dir "/', () => {17 const dir = '/'18 const filePath = getFilePath(dir, defaultFilename)19 expect(filePath).toMatch(/(\w:)?(\\|\/)appium-standalone\.txt/)20 })21 test('should handle dir "./log"', () => {22 const dir = './log'23 const expectedPath = path.join(basePath, dir, defaultFilename)24 const filePath = getFilePath(dir, defaultFilename)25 expect(filePath).toBe(expectedPath)26 })27 test('should handle dir "/log', () => {28 const dir = '/log'29 const filePath = getFilePath(dir, defaultFilename)30 expect(filePath).toMatch(/(\w:)?(\\|\/)log(\\|\/)appium-standalone\.txt/)31 })32 test('should handle dir "./log/"', () => {33 const dir = './log/'34 const expectedPath = path.join(basePath, dir, defaultFilename)35 const filePath = getFilePath(dir, defaultFilename)36 expect(filePath).toBe(expectedPath)37 })38 test('should handle dir "/log/', () => {39 const dir = '/log/'40 const filePath = getFilePath(dir, defaultFilename)41 expect(filePath).toMatch(/(\w:)?(\\|\/)log(\\|\/)appium-standalone\.txt/)42 })43 test('should handle dir "./log/appium"', () => {44 const dir = './log/appium'45 const expectedPath = path.join(basePath, dir, defaultFilename)46 const filePath = getFilePath(dir, defaultFilename)47 expect(filePath).toBe(expectedPath)48 })49 test('should handle dir "log"', () => {50 const dir = 'log'51 const expectedPath = path.join(basePath, dir, defaultFilename)52 const filePath = getFilePath(dir, defaultFilename)53 expect(filePath).toBe(expectedPath)54 })55 test('should handle dir "/log/appium', () => {56 const dir = '/log/appium'57 const filePath = getFilePath(dir, defaultFilename)58 expect(filePath).toMatch(/(\w:)?(\\|\/)log(\\|\/)appium(\\|\/)appium-standalone\.txt/)59 })60 test('should handle file ".log"', () => {61 const file = '.log'62 const expectedPath = path.join(basePath, file)63 const filePath = getFilePath(file, defaultFilename)64 expect(filePath).toBe(expectedPath)65 })66 test('should handle file "./.log"', () => {67 const file = './.log'68 const expectedPath = path.join(basePath, file)69 const filePath = getFilePath(file, defaultFilename)70 expect(filePath).toBe(expectedPath)71 })72 test('should handle file "./log/.log"', () => {73 const file = './log/.log'74 const expectedPath = path.join(basePath, file)75 const filePath = getFilePath(file, defaultFilename)76 expect(filePath).toBe(expectedPath)77 })78 test('should handle file "./appium-log.txt"', () => {79 const file = './appium-log.txt'80 const expectedPath = path.join(basePath, file)81 const filePath = getFilePath(file, defaultFilename)82 expect(filePath).toBe(expectedPath)83 })84 test('should handle file "appium-log.txt"', () => {85 const file = 'appium-log.txt'86 const expectedPath = path.join(basePath, file)87 const filePath = getFilePath(file, defaultFilename)88 expect(filePath).toBe(expectedPath)89 })90 test('should handle file "/appium-log.txt', () => {91 const file = '/appium-log.txt'92 const filePath = getFilePath(file, defaultFilename)93 expect(filePath).toMatch(/(\w:)?(\\|\/)appium-log\.txt/)94 })95 test('should handle file "./log/appium-log.txt"', () => {96 const file = './log/appium-log.txt'97 const expectedPath = path.join(basePath, file)98 const filePath = getFilePath(file, defaultFilename)99 expect(filePath).toBe(expectedPath)100 })101 test('should handle file "log/appium-log.txt"', () => {102 const file = 'log/appium-log.txt'103 const expectedPath = path.join(basePath, file)104 const filePath = getFilePath(file, defaultFilename)105 expect(filePath).toBe(expectedPath)106 })107 test('should handle file "/log/appium-log.txt', () => {108 const file = '/log/appium-log.txt'109 const filePath = getFilePath(file, defaultFilename)110 expect(filePath).toMatch(/(\w:)?(\\|\/)log(\\|\/)appium-log\.txt/)111 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const expectedPath = require('stryker-parent').expectedPath;2const actualPath = require('stryker-parent').actualPath;3const expectedPath = require('stryker-parent/expectedPath');4const actualPath = require('stryker-parent/actualPath');5const expectedPath = require('stryker-parent').expectedPath;6const actualPath = require('stryker-parent').actualPath;7const expectedPath = require('stryker-parent/expectedPath');8const actualPath = require('stryker-parent/actualPath');9const expectedPath = require('stryker-parent').expectedPath;10const actualPath = require('stryker-parent').actualPath;11const expectedPath = require('stryker-parent/expectedPath');12const actualPath = require('stryker-parent/actualPath');13const expectedPath = require('stryker-parent').expectedPath;14const actualPath = require('stryker-parent').actualPath;15const expectedPath = require('stryker-parent/expectedPath');16const actualPath = require('stryker-parent/actualPath');17const expectedPath = require('stryker-parent').expectedPath;18const actualPath = require('stryker-parent').actualPath;19const expectedPath = require('stry

Full Screen

Using AI Code Generation

copy

Full Screen

1var expectedPath = require('stryker-parent').expectedPath;2var path = require('path');3var expected = expectedPath('test.js');4console.log('expected: ' + expected);5console.log('actual: ' + path.resolve('test.js'));6console.log('are they equal? ' + (expected === path.resolve('test.js')));7exports.expectedPath = function (path) {8 return path;9};

Full Screen

Using AI Code Generation

copy

Full Screen

1var expectedPath = require('stryker-parent').expectedPath;2var path = require('path');3var fs = require('fs');4var expected = expectedPath('test.js');5var actual = path.resolve('test.js');6if (expected !== actual) {7 console.log('Expected path to be ' + expected + ' but got ' + actual);8 process.exit(1);9} else {10 console.log('Test passed!');11}12var expectedPath = require('stryker-parent').expectedPath;

Full Screen

Using AI Code Generation

copy

Full Screen

1var expectedPath = require('stryker-parent').expectedPath;2var path = require('path');3var assert = require('assert');4assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));5var expectedPath = require('stryker-parent').expectedPath;6var path = require('path');7var assert = require('assert');8assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));9var expectedPath = require('stryker-parent').expectedPath;10var path = require('path');11var assert = require('assert');12assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));13var expectedPath = require('stryker-parent').expectedPath;14var path = require('path');15var assert = require('assert');16assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));17var expectedPath = require('stryker-parent').expectedPath;18var path = require('path');19var assert = require('assert');20assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));21var expectedPath = require('stryker-parent').expectedPath;22var path = require('path');23var assert = require('assert');24assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));25var expectedPath = require('stryker-parent').expectedPath;26var path = require('path');27var assert = require('assert');28assert.equal(expectedPath('test.js'), path.join('test', 'test.js'));29var expectedPath = require('stryker-parent').expectedPath;30var path = require('path');31var assert = require('assert');32assert.equal(expectedPath('test.js'), path.join('test', 'test

Full Screen

Using AI Code Generation

copy

Full Screen

1const expectedPath = require('stryker-parent').expectedPath;2const path = require('path');3const filePath = path.resolve(expectedPath('test.js'));4console.log(filePath);5const expectedPath = require('stryker-parent').expectedPath;6const path = require('path');7const filePath = path.resolve(expectedPath('test.js'));8console.log(filePath);9const expectedPath = require('stryker-parent').expectedPath;10const path = require('path');11const filePath = path.resolve(expectedPath('test.js'));12console.log(filePath);13const expectedPath = require('stryker-parent').expectedPath;14const path = require('path');15const filePath = path.resolve(expectedPath('test.js'));16console.log(filePath);17const expectedPath = require('stryker-parent').expectedPath;18const path = require('path');19const filePath = path.resolve(expectedPath('test.js'));20console.log(filePath);21const expectedPath = require('stryker-parent').expectedPath;22const path = require('path');23const filePath = path.resolve(expectedPath('test.js'));24console.log(filePath);25const expectedPath = require('stryker-parent').expectedPath;26const path = require('path');27const filePath = path.resolve(expectedPath('test.js'));28console.log(filePath);29const expectedPath = require('stryker-parent').expectedPath;30const path = require('path');31const filePath = path.resolve(expectedPath('test.js'));32console.log(filePath);33const expectedPath = require('stryker-parent').expectedPath;34const path = require('path');35const filePath = path.resolve(expectedPath('test.js'));36console.log(filePath);

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var path = require('path');3module.exports = function(config) {4 config.set({5 { pattern: strykerParent.expectedPath('test.js'), included: true },6 });7};8var strykerParent = require('stryker-parent');9var path = require('path');10module.exports = function(config) {11 config.set({12 { pattern: strykerParent.expectedPath('test.js'), included: true },13 });14};15var strykerParent = require('stryker-parent');16var path = require('path');17module.exports = function(config) {18 config.set({19 { pattern: strykerParent.expectedPath('test.js'), included: true },20 });21};22var strykerParent = require('stryker-parent');23var path = require('path');24module.exports = function(config) {25 config.set({26 { pattern: strykerParent.expectedPath('test.js'), included: true },27 });28};29var strykerParent = require('stryker-parent');30var path = require('path');31module.exports = function(config) {32 config.set({33 { pattern: strykerParent.expectedPath('test.js'), included: true },34 });35};36var strykerParent = require('stryker-parent');37var path = require('path');38module.exports = function(config) {39 config.set({40 { pattern: strykerParent.expectedPath('test.js'), included: true },

Full Screen

Using AI Code Generation

copy

Full Screen

1import { expectedPath } from 'stryker-parent';2console.log(expectedPath);3export const expectedPath = require.resolve('./index.js');4{5}6module.exports = function(config) {7 config.set({8 });9};10[2017-01-01 00:00:00.000] [INFO] Stryker - Loaded config: {11}12module.exports = function(config) {13 config.set({14 });15};16[2017-01-01 00:00:00.000] [INFO] Stryker - Loaded config: {17}

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 stryker-parent 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