投稿時間:2022-12-12 00:13:52 RSSフィード2022-12-12 00:00 分まとめ(19件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita python ファイルの読み書き https://qiita.com/1023shogo2013/items/1e03965c89efe63ba66d wencoding 2022-12-11 23:18:32
js JavaScriptタグが付けられた新着投稿 - Qiita TypeScript(JavaScript) : 日付加減算は Set***() で/ゼロ埋めは "2-digit" で https://qiita.com/baku2san/items/03054210a43a09137ffa awsdynamodb 2022-12-11 23:34:55
js JavaScriptタグが付けられた新着投稿 - Qiita Alpine.jsのライフサイクル https://qiita.com/yowatsuyoengineer/items/13caa80417ce08f0bef5 ltbuttonxinitconsolelo 2022-12-11 23:26:34
js JavaScriptタグが付けられた新着投稿 - Qiita GTM Container Switcher https://qiita.com/sebisawa/items/2e4a6540af72a4d29047 chrome 2022-12-11 23:23:51
AWS AWSタグが付けられた新着投稿 - Qiita ALB vs NLB https://qiita.com/the13-HK/items/5bc44c6a21c665109853 albvsnlb 2022-12-11 23:58:08
Docker dockerタグが付けられた新着投稿 - Qiita nginx on docker https://qiita.com/kaizen_nagoya/items/c3898540babc590465da unabletofindimagenginx 2022-12-11 23:47:58
Azure Azureタグが付けられた新着投稿 - Qiita Blobライフサイクル管理で自動削除された履歴をログに残す https://qiita.com/shingo_kawahara/items/63272548271c6886348e adventcalendar 2022-12-11 23:52:01
Ruby Railsタグが付けられた新着投稿 - Qiita RSpecでElasticsearchを使用しているモデルのテストでのみインデックスの初期化を行う方法 https://qiita.com/isaka1022/items/d6d8bd85c67706348e59 elasticsearch 2022-12-11 23:28:50
技術ブログ Developers.IO [レポート] E-3 あなたの手元の本よりいい方法がある! UXデザインのプロはこうやってユーザーのインサイトを確実に見つける – プロダクトマネージャーカンファレンス2022 #pmconf2022 https://dev.classmethod.jp/articles/report-pmconf2022-e3/ pmconf 2022-12-11 14:54:11
技術ブログ Developers.IO AWS IoT TwinMaker Knowledge Graphを試してみた #reinvent https://dev.classmethod.jp/articles/tried-the-aws-iot-twinmaker-knowledge-graph-reinvent/ twinm 2022-12-11 14:30:30
海外TECH DEV Community Guide to Yaml https://dev.to/abbhiishek/guide-to-yaml-339b Guide to YamlYAML YAML Ain t Markup Language is a human readable data serialization language It is often used for configuration files but can be used in many other contexts as well In this blog we will take a look at the basics of YAML and how it can be used by developers First let s define what a YAML file is A YAML file is a text file that uses the YAML syntax to specify data structures These data structures can be a mix of scalar values strings numbers etc lists and associative arrays also known as maps or dictionaries Here is an example of a YAML file that defines a simple list item item itemThis YAML file defines a list of three items item item and item You can see that the list is denoted by a dash followed by the item Now let s take a look at how we can define a more complex data structure in YAML Here is an example of a YAML file that defines an associative array key valuekey valuekey subkey subvalue subkey subvalueIn this example we have defined an associative array with three keys key key and key The value for key and key are simple scalar values but the value for key is a list of associative arrays One of the benefits of using YAML is that it is very readable and easy to write It also supports comments which can be useful for documenting your YAML files Here is an example of a YAML file with comments This is a commentkey value This is another comment It can span multiple lineskey subkey subvalue subkey subvalueAs you can see comments in YAML are denoted by the character and can be placed on their own line or after a value Another benefit of YAML is that it is versatile and can be used in many different contexts For example it is commonly used for configuration files in software projects Here is an example of a YAML configuration file This is a sample configuration file Global settingsglobal The name of the project name My Project Database settingsdatabase The type of database to use type mysql The database host host localhost The database port port The database username username root The database password password passwordIn this example we have defined a configuration file with two sections global and database The global section contains a single key value pair while the database section contains several keys with their corresponding values YAML is also used in other contexts such as for defining Kubernetes resources Here is an example of a YAML file that defines a Kubernetes Deployment apiVersion apps vAs mentioned earlier YAML is a versatile language and can be used in many different contexts In addition to configuration files and Kubernetes resources YAML is also used in other tools and frameworks such as Ansible and Rails In Ansible YAML is used to define playbooks which are files that specify a set of tasks to be executed on one or more remote hosts Here is an example of an Ansible playbook written in YAML hosts all tasks name Install Apache apt name apache state present name Start Apache service name apache state startedIn this example we have defined a playbook that installs and starts Apache on all hosts in the all group The playbook is written in YAML and consists of two tasks Install Apache and Start Apache In Rails YAML is used for a variety of purposes such as defining translations and fixtures Here is an example of a YAML file used for defining translations in Rails en hello Hello world World fr hello Bonjour world Monde In this example we have defined translations for the words hello and world in English and French The translations are organized in a YAML file with the language code as the key and the translations as the values As you can see YAML is a useful and versatile language that can be used in many different contexts by developers It is easy to read and write supports comments and can be used for a variety of purposes In conclusion YAML is a human readable data serialization language that is often used for configuration files and other purposes It is easy to read and write supports comments and can be used in many different contexts such as Ansible playbooks and Rails translations Developers can use YAML to organize and represent their data in a clear and concise way 2022-12-11 14:50:45
海外TECH DEV Community TypeScript https://dev.to/abbhiishek/typescript-3abm TypeScriptWhen it comes to web development JavaScript is one of the most popular and widely used programming languages However many developers have started using TypeScript a programming language that is based on JavaScript but adds additional features and capabilities So why choose TypeScript over JavaScript In this blog post we will explore the advantages of TypeScript and discuss why it can be a valuable tool for web developers What is TypeScript TypeScript is a programming language that was developed and open sourced by Microsoft in It is a statically typed language which means that variables and functions have a specific type and the TypeScript compiler checks for type errors at compile time TypeScript is built on top of JavaScript and it is fully compatible with JavaScript This means that you can use TypeScript in any JavaScript project and any valid JavaScript code is also valid TypeScript code The main advantage of TypeScript over JavaScript is its strong typing system In JavaScript variables and functions do not have a specific type and type errors are only caught at runtime This can make it difficult to write and maintain large and complex JavaScript applications In contrast TypeScript s strong typing system allows the compiler to catch type errors at compile time before the code is even run This can help prevent bugs and make it easier to refactor and maintain your code Object Oriented FeaturesIn addition to its strong typing system TypeScript also adds object oriented features to the language TypeScript supports classes interfaces and modules which can make it easier to structure and organize your code This can be particularly useful for large and complex applications where a well defined structure can make it easier to understand and maintain the code Good Integration with Popular JavaScript Libraries and FrameworksAnother advantage of TypeScript is its good integration with popular JavaScript libraries and frameworks TypeScript has strong support for React Angular and Node js among others This means that you can use TypeScript in your existing JavaScript projects and take advantage of its strong typing and object oriented features This can make it easier to write and maintain large and complex JavaScript applications Overall TypeScript can be a valuable tool for web developers who want to write large and complex JavaScript applications Its strong typing and object oriented features can make it easier to write and maintain your code and its good integration with popular JavaScript libraries and frameworks can make it a valuable addition to your toolkit If you are a JavaScript developer who is looking to improve the quality and maintainability of your code consider giving TypeScript a try It may take some time to learn the additional features and syntax of the language but the benefits can be well worth it in the long run To get started with TypeScript you will need to install the TypeScript compiler on your computer The TypeScript compiler or tsc is a command line tool that allows you to transpile TypeScript code into JavaScript code To install the TypeScript compiler you will need to have Node js and npm the Node js package manager installed on your computer If you don t have these tools installed you can download and install them from the Node js website Once you have Node js and npm installed you can use the following command to install the TypeScript compiler npm install g typescriptThis will install the TypeScript compiler globally on your system allowing you to use it from the command line Once the TypeScript compiler is installed you can create a TypeScript file with a ts extension For example you might create a file called hello ts that contains the following code function sayHello name string console log Hello name sayHello TypeScript This code defines a simple function called sayHello that takes a string argument and logs a greeting to the console The function is annotated with a type signature which specifies that the name argument is a string To transpile this TypeScript code into JavaScript code you can use the following command tsc hello tsThis will create a file called hello js that contains the equivalent JavaScript code function sayHello name console log Hello name sayHello TypeScript You can then run this JavaScript code using the Node js runtime node hello jsThis will output the following message to the console Hello TypeScriptAnd that s it You have successfully transpiled your first TypeScript code into JavaScript and run it using the Node js runtime From here you can continue learning and experimenting with TypeScript and explore its many features and capabilities Once you have the TypeScript compiler installed you can start using it to transpile your TypeScript code into JavaScript code In addition to the basic usage described above there are a few other things you can do with the TypeScript compiler You can use the watch flag to tell the compiler to watch for changes to your TypeScript files and automatically transpile them whenever they are saved This can save you time and effort and make it easier to develop your TypeScript code You can use the outFile flag to specify the name of the output JavaScript file By default the compiler will create a JavaScript file with the same name as the TypeScript file but with a js extension However you can use the outFile flag to specify a different name or location for the output file You can use the target flag to specify the version of JavaScript that you want your TypeScript code to be transpiled into By default the compiler will transpile your code into the latest version of JavaScript ES However you can use the target flag to specify an older version of JavaScript such as ES if you need to support older browsers or environments You can use the sourceMap flag to generate a source map for your TypeScript code A source map is a file that maps the generated JavaScript code back to the original TypeScript code allowing you to debug your TypeScript code using the original source files This can make it easier to debug and troubleshoot your TypeScript code Overall the TypeScript compiler is a powerful and flexible tool that allows you to transpile your TypeScript code into JavaScript code By using the various flags and options available you can customize the compiler to suit your needs and preferences In addition to the basic usage and advanced features of the TypeScript compiler described above there are a few other things you can do to make the most of TypeScript Use a TypeScript aware code editor or IDE Many popular code editors and IDEs such as Visual Studio Code WebStorm and Sublime Text have built in support for TypeScript This can make it easier to write and debug your TypeScript code and take advantage of features such as code completion and error highlighting Use type definitions for popular JavaScript libraries and frameworks TypeScript includes a large number of built in type definitions but you can also use third party type definitions to add type information for popular JavaScript libraries and frameworks This can make it easier to use these libraries and frameworks with TypeScript and take advantage of the type checking and other features of the language Use a build tool or task runner While the TypeScript compiler is a powerful tool it can be tedious to manually run the compiler and manage your TypeScript files To make this easier you can use a build tool or task runner such as Webpack or Grunt to automate the process of transpiling your TypeScript code and managing your project files Use a type checker In addition to the TypeScript compiler you can also use a separate type checker such as TSLint or Flow to perform static type checking on your TypeScript code This can help you catch and fix type errors and other issues before they become bugs in your code Overall there are many ways to make the most of TypeScript and take advantage of its powerful features and capabilities By using the right tools and techniques you can write high quality and maintainable TypeScript code and build large and complex JavaScript applications Type annotationsType annotations in TypeScript are used to specify the type of a variable function or other language construct This allows the TypeScript compiler to check for type errors at compile time and helps you avoid common bugs and mistakes To use type annotations you simply specify the type of a variable or function after its name using a colon and the type name For example the following code defines a variable called name with the type string let name string In this code the string type annotation tells the TypeScript compiler that the name variable can only be assigned values of type string If you try to assign a value of a different type the compiler will raise an error You can also use type annotations for function arguments and return values For example the following code defines a function called sayHello that takes a name argument of type string and returns a value of type string function sayHello name string string return Hello name In this code the type annotations for the name argument and the return value tell the TypeScript compiler that the sayHello function expects a string as input and returns a string as output If you try to call the function with an argument of a different type or if the function tries to return a value of a different type the compiler will raise an error Type annotations are optional in TypeScript but they are highly recommended By using type annotations you can take advantage of the strong typing and type checking capabilities of TypeScript and write more reliable and maintainable code In TypeScript an object type is a type that represents the structure of an object including the names and types of its properties and methods Object types are defined using the syntax and they can be used to annotate variables function arguments and return values For example the following code defines an object type called Person that has two properties name and age of type string and number respectively type Person name string age number In this code the Person object type defines the structure of a person object including the names and types of its name and age properties You can then use the Person object type to annotate a variable that holds a person object For example let person Person name Jane age In this code the person variable is annotated with the Person object type which tells the TypeScript compiler that the person variable must be an object with name and age properties of type string and number respectively You can also use object types to annotate function arguments and return values For example function getPerson id number Person lookup and return the person object with the given id In this code the getPerson function is annotated with the Person object type which tells the TypeScript compiler that the getPerson function expects a number as input and returns a Person InterfaceIn TypeScript an interface is a language construct that defines a contract for types that implement it An interface specifies the names and types of properties and methods that a type must have and it allows you to enforce a common structure and behavior among related types To define an interface you use the interface keyword followed by the name of the interface and a list of the properties and methods that the interface defines For example interface Person name string age number greet string In this code the Person interface defines a type with a name property of type string an age property of type number and a greet method that returns a string Once an interface is defined you can use it to annotate the types that implement it For example class Employee implements Person name string age number constructor name string age number this name name this age age greet string return Hello my name is this name In this code the Employee class implements the Person interface This means that the Employee class must have the name age and greet properties and methods defined by the Person interface If the Employee class does not implement these properties and methods or if it implements them with the wrong names or types the TypeScript compiler will raise an error Interfaces are a powerful feature of TypeScript that allow you to define common structures and behaviors for related types By using interfaces you can enforce a consistent design and implementation among your types and make your code more maintainable and reusable ClassIn TypeScript a class is a language construct that allows you to define a blueprint for an object A class specifies the properties and methods that an object of that class will have and it defines the structure and behavior of the object To define a class in TypeScript you use the class keyword followed by the name of the class and the body of the class enclosed in curly braces The body of the class can contain properties methods and other class members which define the structure and behavior of the object For example the following code defines a Person class with a name property and a greet method class Person name string constructor name string this name name greet string return Hello my name is this name In this code the Person class has a name property of type string and a greet method that returns a string The class also has a constructor which is a special method that is called when an object of the class is created The constructor initializes the name property of the object Once a class is defined you can create objects of that class using the new keyword For example let person new Person Jane console log person greet Hello my name is Jane In this code the person variable is assigned an object of the Person class with the given name value The greet method of the object is then called which outputs the greeting message to the console Classes are a powerful feature of TypeScript that allow you to define reusable and extensible object types By using classes you can organize and structure your code in a way that is intuitive and easy to understand and that allows for flexibility and reuse React TypescriptReact is a popular JavaScript library for building user interfaces and TypeScript is a powerful typed superset of JavaScript Together React and TypeScript can provide a powerful and productive development experience with the benefits of type checking and other features of TypeScript To use React with TypeScript you will need to have the React and TypeScript libraries installed on your development machine If you don t already have them installed you can use the following commands to install them using npm the Node js package manager npm install reactnpm install typescriptOnce you have the React and TypeScript libraries installed you can create a new React project using the create react app command line tool This tool will set up a new React project with TypeScript support and create the necessary files and configuration for you To create a new React project with TypeScript support run the following command npx create react app my app template typescriptThis will create a new React project called my app with TypeScript support enabled The create react app tool will set up the project install the necessary dependencies and create the initial project files Once the project is set up you can start writing your React components using TypeScript TypeScript components in React are similar to regular JavaScript components but they have type annotations that specify the types of their props and state For example the following code defines a Hello component that has a name prop of type string import React from react type HelloProps name string const Hello React FC lt HelloProps gt props HelloProps gt return lt p gt Hello props name lt p gt export default Hello In this code the HelloProps type defines the structure of the Hello component s props with a name property of type string The Hello component is then defined as a functional component with a type parameter that specifies the HelloProps type This tells the TypeScript compiler that the Hello component expects a name prop of type string and that any other props passed to the component must match the shape of the HelloProps type You can then use the Hello component in your React app just like any other component For example import React from react import Hello from Hello function App return lt div gt lt Hello name TypeScript gt lt div gt export default App In addition to type checking for props and state TypeScript can also provide type checking for event handlers and other functions in your React components For example the following code defines an event handler for a button click event and uses TypeScript to specify the type of the event object import React from react type HelloProps name string const Hello React FC lt HelloProps gt props HelloProps gt const handleClick event React MouseEvent lt HTMLButtonElement gt gt console log event type return lt button onClick handleClick gt Click me lt button gt export default Hello In this code the handleClick event handler is defined with a type parameter that specifies the type of the event object This tells the TypeScript compiler that the handleClick function expects an event object of type React MouseEvent and that the event type property will be of type string This allows the TypeScript compiler to provide type checking for the event object and help you avoid type errors and bugs in your code Overall using React and TypeScript together can provide a powerful and productive development experience with the benefits of type checking and other features of TypeScript By using TypeScript in your React components you can write more reliable and maintainable code and catch type errors and other issues early in the development process Here are a few tips for using React and TypeScript together Use type definitions for React and other libraries TypeScript includes a large number of built in type definitions but you can also use third party type definitions to add type information for popular JavaScript libraries and frameworks such as React This can make it easier to use these libraries with TypeScript and take advantage of the type checking and other features of the language Annotate props and state with precise types In React components props and state are the source of truth for the component s data and behavior By using precise and explicit types for your props and state you can enable the TypeScript compiler to provide type checking and validation for your component data and help you avoid type errors and bugs Use type parameters for functions and event handlers In your React components you will often need to define functions and event handlers that handle specific types of data or events By using type parameters and type annotations you can specify the types of these functions and event handlers and enable the TypeScript compiler to provide type checking and validation for them Use interfaces to define common structures and behaviors In complex React applications you will often need to define common structures and behaviors that are shared among multiple components By using interfaces you can define these common structures and behaviors in a single place and use them to annotate your components and enable type checking Overall using React and TypeScript together can provide many benefits including improved reliability and maintainability of your code By following these tips and using the features of TypeScript effectively you can build high quality and scalable React applications 2022-12-11 14:48:56
海外TECH DEV Community Finding a job with no prior experience. https://dev.to/lotfijb/finding-a-job-with-no-prior-experience-4olg Finding a job with no prior experience Finding a job with no prior experience can be challenging as many employers prefer to hire candidates who have already demonstrated their skills and abilities in the workforce However it is not impossible to find a job without prior experience One way to make yourself more appealing to potential employers is to highlight any transferable skills you may have You can also consider volunteer opportunities to gain experience in your desired field Networking and reaching out to connections in your industry can also be helpful in finding job opportunities It may take some extra effort but with determination and a positive attitude you can find a job even without prior experience Dear Recruiters There are several reasons why you should consider hiring someone with no prior experience First individuals who have no prior experience may bring fresh perspectives and new ideas to your company They may also be more open to learning and trying new things which can be beneficial for a company that is looking to innovate or try new approaches Additionally hiring someone with no prior experience can also be a cost effective option as they may be willing to accept a lower salary than a more experienced candidate Furthermore by providing training and support you can help shape the individual into a valuable asset to your company Overall hiring someone with no prior experience can be a valuable addition to your team You should give those with no prior experience a chance because everyone has to start somewhere Lack of experience does not necessarily equate to a lack of potential or ability 2022-12-11 14:31:47
海外TECH DEV Community API Automation using SuperTest Mocha ChaiJS and FakerJS https://dev.to/codewithmmak/api-automation-using-supertest-mocha-chaijs-and-fakerjs-1bc7 API Automation using SuperTest Mocha ChaiJS and FakerJSI have been using JavaScript for UI automation and am in love with it for many reasons but one of the reasons that always helps me is when I Google any library package with just npm word there are many solutions available which makes life so much easier The other benefit is saving time as well It is possible to automate API tests using several tools available on the market It is up to you to choose which tool is most appropriate for your needs The first thing I did was to explore and try to find some library package on npm which I could use to test APIs In the end I found SuperTest to be the answer to my search Using this tool may be the best solution for scaling your automation framework with additional capabilities It s easy to use and allows you to easily integrate it into existing automation frameworks In this article we will be using SuperTest Mocha and Chai We will use FakerJS to generate the test data and JavaScript for scripting Let s look into them one by one SuperTestSuperTest module is to provide a high level abstraction for testing HTTP while still allowing you to drop down to the lower level API provided by superagent MochaMocha is a feature rich JavaScript test framework running on Node js and in the browser making asynchronous testing simple and fun Mocha tests run serially allowing for flexible and accurate reporting while mapping uncaught exceptions to the correct test cases ChaiChai is a BDD TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework FakerGenerate massive amounts of fake but realistic data for testing and development Getting StartedStep To start with you need to have Node js installed on your machine You can download it directly from the Node js website and install it on your machine if you are not already using it Once installed check the versionnode vStep Install Visual Studio Code this will help you write formatted code but you can pick any text editor of your choice Step Open Visual Studio CodeStep Open your integrated Terminal and run the following commandmkdir supertest mocha chai javascriptStep Open the directorycd supertest mocha chai javascriptStep Create a new package json filenpm init yYour package json file should be like this name supertest mocha chai javascript version description main index js scripts test echo Error no test specified amp amp exit keywords author license ISC Step I will be using Mocha JavaScript test framework for writing the API tests ChaiJS for assertions and mochawesome to generate HTML reports Also I will use Faker one of the powerful packages to generate test dummy data Install all the required packagesnpm install save dev supertest mocha chai mochawesome faker js fakerOnce the installation is complete node module will be created with all the dependencies installed in it Your package json file should look like this name supertest mocha chai javascript version description main index js scripts test echo Error no test specified amp amp exit keywords supertest mocha chai mochawesome author Code with MMAK license ISC devDependencies faker js faker chai mocha mochawesome supertest Step Create a gitignore file so that unwanted files are not committed to the repositorynode modules mochawesome report test results downloads log Now you can start writing your API tests Following is the list of APIs on the Reqres A hosted REST API ready to respond to your AJAX requests website which I have used to write end to end tests Create a userGet the user detailsUpdated user detailsUpdate the user with partial detailsDelete userFor the end to end automation testing strategy I have followed the steps given below Create a user with when the date is supplied from the JSON file Also as the real time approach I have used the Fakerjs npm package which will give you dummy test data which looks real Assert the response by either comparing it with JSON data or by matching it with data stored in the variable Get the user details by query param without query param and path param And assert the response for each Updated user full details and assert the responseUpdate user practical details and assert the response Finally delete the user and assert the response It s time to code Base SetupTo being with we will start implementing the base so that it can be reused and we are not going to write unnecessary repeated code Create a folder and name it config inside this folder create a JSON file named reqres config json file here we will keep our base URL which is the test URL baseUrl POST RequestTo being with create a folder and name it test reqres api and then create a test file named postTest js We are going to create a post request by using data stored in JSON with this we will be able to create a user Create a folder named test data and then create a JSON file named user data json name Code with MMAK job Testing Now start writing a line of code to import the supertest library and expect the library from chai const request require supertest const expect require chai expect const reqres require config reqres config json const userData require test data user data json describe POST API tests using SuperTest gt it should successfully pass the test for POST api when test data from json file is used done gt request reqres baseUrl post api users send userData set Accept application json set Content Type application json end function err res expect res statusCode to be equal expect res body name to be equal Code with MMAK expect res body job to be equal Testing expect res body id not to be null expect res body createdAt not to be null done Here describe means test scenario and it means individual test casespost is the request typesend is to send the data with the post requestset is to set the header of the requestend is to say the request is ended and we will perform the assertionexpect is to validate the responsedone is to say our request is completed and the test is done Let s run the test mocha test reqres api reporter spec reporter mochawesome timeout Dummy data using fakerjsconst request require supertest const expect require chai expect const faker require faker js faker const reqres require config reqres config json const randomName faker name findName const randomJob faker name jobTitle describe POST API tests using SuperTest gt it should successfully pass the test for POST api when fakerjs dummy data is used done gt request reqres baseUrl post api users send name randomName job randomJob set Accept application json set Content Type application json end function err res expect res statusCode to be equal expect res body name to be equal randomName expect res body job to be equal randomJob expect res body id not to be null expect res body createdAt not to be null done GET RequestCreate a file named getTest js and write the following code const request require supertest const expect require chai expect const reqres require config reqres config json describe GET API tests using SuperTest gt it should successfully pass the test for get api without query param done gt request reqres baseUrl get api users set Accept application json set Content Type application json end function err res expect res statusCode to be equal expect res body data id to be equal expect res body data first name to be equal Janet done it should successfully pass the test for get api with query param done gt request reqres baseUrl get api users query page end function err res expect res statusCode to be equal expect res body page to be equal expect res body data id to be equal expect res body data first name to be equal Michael done PUT RequestCreate a file named putTest js and write the following code const request require supertest const expect require chai expect const reqres require config reqres config json describe PUT API tests using SuperTest gt it should successfully pass the test for post api done gt request reqres baseUrl put api users send name Andy job Admin set Accept application json set Content Type application json end function err res expect res statusCode to be equal expect res body name to be equal Andy expect res body job to be equal Admin expect res body updatedAt not to be null done PATCH RequestCreate a file named patchTest js and write the following code const request require supertest const expect require chai expect const reqres require config reqres config json describe PATCH API tests using SuperTest gt it should successfully pass the test for patch request done gt request reqres baseUrl patch api users send name Mike job Test Lead set Accept application json set Content Type application json end function err res expect res statusCode to be equal expect res body name to be equal Mike expect res body job to be equal Test Lead expect res body updatedAt not to be null done DELETE RequestCreate a file named deleteTest js and write the following code const request require supertest const expect require chai expect const reqres require config reqres config json describe DELETE API tests using SuperTest gt it should successfully pass the test for delete request done gt request reqres baseUrl delete api users set Accept application json set Content Type application json end function err res expect res statusCode to be equal done Some TipsIf you want to run a single test then use it only Similarly if you want to run a single test scenario then use describe only If you want to skip any test in a test suite then use it skip Similarly if you want to skip the test scenario then use describe skip Code RepositoryThe sample framework is hosted on GitHub Have a suggestion or found a bug Fork this project to help make this even better Star the repo and follow me to get the latest updates What Do You Think Did this work for you Could I have done something better Have I missed something Please share your thoughts and let me know if there are particular things that you would enjoy reading further Cheers 2022-12-11 14:30:32
海外科学 NYT > Science Live Updates: NASA’s Artemis I Moon Mission Returns to Earth https://www.nytimes.com/live/2022/12/11/science/nasa-artemis-orion-splashdown Live Updates NASA s Artemis I Moon Mission Returns to EarthThe Orion spacecraft which is to carry astronauts to and from the moon in coming years will splash down in the Pacific Ocean Sunday after a test flight with no crew aboard 2022-12-11 14:50:37
海外科学 NYT > Science Behind New York City’s Shift on Mental Health, a Solitary Quest https://www.nytimes.com/2022/12/11/health/fuller-torrey-psychosis-commitment.html Behind New York City s Shift on Mental Health a Solitary QuestThe psychiatrist E Fuller Torrey has been advocating tougher involuntary psychiatric treatment policies for years Now it s paying off 2022-12-11 14:27:52
ニュース BBC News - Home Nurses' union wants health secretary to talk pay https://www.bbc.co.uk/news/uk-63931904?at_medium=RSS&at_campaign=KARANGA college 2022-12-11 14:49:13
ニュース BBC News - Home Lockerbie bombing suspect in US custody https://www.bbc.co.uk/news/uk-scotland-63933837?at_medium=RSS&at_campaign=KARANGA lockerbie 2022-12-11 14:29:24
ニュース BBC News - Home Manchester City 1-1 Manchester United: Entertaining WSL derby ends in draw https://www.bbc.co.uk/sport/football/63849445?at_medium=RSS&at_campaign=KARANGA etihad 2022-12-11 14:34:15

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)