> digiboxy-accounting-backend@1.0.0 test > cross-env NODE_ENV=test jest node.exe : (node:21688) [DEP0170] DeprecationWarning: The URL sqlite::memory: is invalid. Future versions of Node.js will throw an error. At C:\Program Files\nodejs\npm.ps1:29 char:3 + & $NODE_EXE $NPM_CLI_JS $args + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ((node:21688) [D...throw an error.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError (Use `node --trace-deprecation ...` to show where the warning was created) (node:28232) [DEP0170] DeprecationWarning: The URL sqlite::memory: is invalid. Future versions of Node.js will throw an error. (Use `node --trace-deprecation ...` to show where the warning was created) console.log ✓ Database connection has been established successfully. at log (src/config/database.js:55:13) console.log ✓ Database connection has been established successfully. at log (src/config/database.js:55:13) FAIL src/tests/integration/multi-company.test.js Multi-Company Integration × Create Account in Company A (4 ms) × Verify Account in Company A (1 ms) × Verify Account NOT in Company B × Create Account in Company B (Same Code) ● Multi-Company Integration › Create Account in Company A AggregateError:   41 |  42 | // Associate Admin with Companies > 43 | await adminUser.addCompany(companyA);  | ^  44 | await adminUser.addCompany(companyB);  45 |  46 | // Login to get token at recursiveBulkCreate (node_modules/sequelize/src/model.js:2734:17) at Function.bulkCreate (node_modules/sequelize/src/model.js:2977:12) at async Promise.all (index 0) at BelongsToMany.add (node_modules/sequelize/src/associations/belongs-to-many.js:747:30) at Object. (src/tests/integration/multi-company.test.js:43:5) ● Multi-Company Integration › Verify Account in Company A AggregateError:   41 |  42 | // Associate Admin with Companies > 43 | await adminUser.addCompany(companyA);  | ^  44 | await adminUser.addCompany(companyB);  45 |  46 | // Login to get token at recursiveBulkCreate (node_modules/sequelize/src/model.js:2734:17) at Function.bulkCreate (node_modules/sequelize/src/model.js:2977:12) at async Promise.all (index 0) at BelongsToMany.add (node_modules/sequelize/src/associations/belongs-to-many.js:747:30) at Object. (src/tests/integration/multi-company.test.js:43:5) ● Multi-Company Integration › Verify Account NOT in Company B AggregateError:   41 |  42 | // Associate Admin with Companies > 43 | await adminUser.addCompany(companyA);  | ^  44 | await adminUser.addCompany(companyB);  45 |  46 | // Login to get token at recursiveBulkCreate (node_modules/sequelize/src/model.js:2734:17) at Function.bulkCreate (node_modules/sequelize/src/model.js:2977:12) at async Promise.all (index 0) at BelongsToMany.add (node_modules/sequelize/src/associations/belongs-to-many.js:747:30) at Object. (src/tests/integration/multi-company.test.js:43:5) ● Multi-Company Integration › Create Account in Company B (Same Code) AggregateError:   41 |  42 | // Associate Admin with Companies > 43 | await adminUser.addCompany(companyA);  | ^  44 | await adminUser.addCompany(companyB);  45 |  46 | // Login to get token at recursiveBulkCreate (node_modules/sequelize/src/model.js:2734:17) at Function.bulkCreate (node_modules/sequelize/src/model.js:2977:12) at async Promise.all (index 0) at BelongsToMany.add (node_modules/sequelize/src/associations/belongs-to-many.js:747:30) at Object. (src/tests/integration/multi-company.test.js:43:5) console.error GraphQL Error: { message: 'Insufficient permissions in this company. Required: admin, accountant', locations: [ { line: 3, column: 15 } ], path: [ 'createAccount' ], extensions: { code: 'INTERNAL_SERVER_ERROR' } }   22 | resolvers,  23 | formatError: (error) => { > 24 | console.error('GraphQL Error:', error);  | ^  25 | return {  26 | message: error.message,  27 | locations: error.locations, at error (src/server.js:24:13) at node_modules/@apollo/server/src/errorNormalize.ts:41:16 at Array.map () at normalizeAndFormatErrors (node_modules/@apollo/server/src/errorNormalize.ts:39:29) at formatErrors (node_modules/@apollo/server/src/requestPipeline.ts:688:36) at processGraphQLRequest (node_modules/@apollo/server/src/requestPipeline.ts:484:11) at internalExecuteOperation (node_modules/@apollo/server/src/ApolloServer.ts:1334:12) at runHttpQuery (node_modules/@apollo/server/src/runHttpQuery.ts:232:27) at runPotentiallyBatchedHttpQuery (node_modules/@apollo/server/src/httpBatching.ts:85:12) at ApolloServer.executeHTTPGraphQLRequest (node_modules/@apollo/server/src/ApolloServer.ts:1109:14) FAIL src/tests/integration/company-permissions.test.js Company-Level Permissions User with different roles across companies √ User can create account in Company A (Admin role) (39 ms) √ User CANNOT create account in Company B (Viewer role) (30 ms) User-Company Management √ Admin can assign user to company with role (26 ms) √ Admin can update user role in company (20 ms) × Cannot remove last admin from company (24 ms) √ Admin can remove user from company (19 ms) UserCompanies Query × User can query their company-role assignments (22 ms) ● Company-Level Permissions › User-Company Management › Cannot remove last admin from company expect(received).toBeDefined() Received: undefined   279 | });  280 | > 281 | expect(res.body.errors).toBeDefined();  | ^  282 | expect(res.body.errors[0].message).toContain('at least one admin');  283 | });  284 | at Object.toBeDefined (src/tests/integration/company-permissions.test.js:281:31) ● Company-Level Permissions › UserCompanies Query › User can query their company-role assignments expect(received).toBe(expected) // Object.is equality Expected: "admin" Received: "viewer"   341 | uc => uc.company.name === 'Company A'  342 | ); > 343 | expect(companyARoles.role.code).toBe('admin');  | ^  344 |  345 | const companyBRoles = res.body.data.me.userCompanies.find(  346 | uc => uc.company.name === 'Company B' at Object.toBe (src/tests/integration/company-permissions.test.js:343:39) Test Suites: 2 failed, 2 total Tests: 6 failed, 5 passed, 11 total Snapshots: 0 total Time: 2.981 s, estimated 3 s Ran all test suites.