{"library":"retyped-chai-http-tsd-ambient","title":"Retyped Chai-HTTP Typings","description":"This package provides TypeScript ambient type declarations for the `chai-http` library. It originates from the `retyped` project, which aimed to offer curated typings for various JavaScript libraries. However, the `retyped` project itself appears to be abandoned, with most packages, including this one, maintaining a `0.0.0-0` version number, indicating no active development or updates. Modern `chai-http` (version 4.2.4 and above) ships with its own built-in TypeScript definitions, making external typing packages like `retyped-chai-http-tsd-ambient` largely obsolete. Users are generally advised to rely on `chai-http`'s native types rather than this unmaintained package or even the stub `@types/chai-http` package.","language":"javascript","status":"abandoned","last_verified":"Wed Apr 22","install":{"commands":["npm install retyped-chai-http-tsd-ambient"],"cli":null},"imports":["import * as chai from 'chai';","import chaiHttp from 'chai-http';","import { request } from 'chai-http';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import * as chai from 'chai';\nimport chaiHttp from 'chai-http';\nimport { Application } from 'express'; // Assuming Express.js application\nimport 'mocha'; // For test runner globals\n\n// Optionally import superagent types if not implicitly resolved by chai-http's built-in types\n// import '@types/superagent';\n\n// Initialize Chai HTTP plugin\nchai.use(chaiHttp);\n\n// Create a dummy Express app for testing\nconst app: Application = require('express')();\napp.get('/test', (req, res) => res.status(200).send('Hello Test!'));\napp.post('/data', (req, res) => res.status(201).json({ message: 'Data received' }));\n\ndescribe('Chai-HTTP with TypeScript', () => {\n  it('should get a successful response from /test', (done) => {\n    chai.request(app)\n      .get('/test')\n      .end((err, res) => {\n        chai.expect(err).to.be.null;\n        chai.expect(res).to.have.status(200);\n        chai.expect(res.text).to.equal('Hello Test!');\n        done();\n      });\n  });\n\n  it('should post data and get a created response from /data', (done) => {\n    chai.request(app)\n      .post('/data')\n      .send({ item: 'test' })\n      .end((err, res) => {\n        chai.expect(err).to.be.null;\n        chai.expect(res).to.have.status(201);\n        chai.expect(res).to.be.json;\n        chai.expect(res.body.message).to.equal('Data received');\n        done();\n      });\n  });\n});\n","lang":"typescript","description":"Demonstrates a basic TypeScript test setup using `chai`, `chai-http`, and `mocha` to make and assert HTTP requests against a simple Express.js application, leveraging the provided typings.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}