Svelte with Test-Driven Development by Daniel Irvine
Author:Daniel Irvine
Language: eng
Format: epub
Publisher: Packt Publishing Pvt Ltd
Published: 2023-06-09T00:00:00+00:00
Update them to use the createBirthday helper, shown here:
await performFormAction( createBirthday('Zeus', '2009-02-02') );
There are a couple of tests where the preceding change isnât straightforward. In the saves unique ids one each new birthday test, you can save the created birthday in the request object, and then pass that into performFormAction twice, as shown in the following code:
it('saves unique ids onto each new birthday', async () => { const request = createBirthday( 'Zeus', '2009-02-02' ); await performFormAction(request); await performFormAction(request); expect(birthdayStore.getAll()[0].id).not.toEqual( birthdayStore.getAll()[1].id ); });
The updates an entrythat shares the same id test needs a specific id passed into the second invocation. Note how the factory method is structured in such a way that uncommon information needs to be named, such as the id field:
it('updates an entry that shares the same id', async () => { await performFormAction( createBirthday('Zeus', '2009-02-02') ); await performFormAction( createBirthday('Zeus Ex', '2007-02-02', { id: storedId() }) ); expect(birthdayStore.getAll()).toHaveLength(1); expect(birthdayStore.getAll()).toContainEqual({ id, name: 'Zeus Ex', dob: '2007-02-02' }); });
For the final test suite, in src/routes/birthdays/page.test.js, the birthdays array can be updated to use two calls to createBirthday, as shown here: const birthdays = [ createBirthday('Hercules', '1994-02-02', { id: '123' }), createBirthday('Athena', '1989-01-01', { id: '234' }) ];
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Content Management | Programming |
User Experience & Usability | User Generated Content |
Web Design | Web Marketing |
Web Services | Website Analytics |
Hello! Python by Anthony Briggs(9373)
The Mikado Method by Ola Ellnestam Daniel Brolund(9307)
Dependency Injection in .NET by Mark Seemann(8860)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7402)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7117)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6251)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(5957)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5514)
Kotlin in Action by Dmitry Jemerov(4638)
Audition by Ryu Murakami(4100)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(3889)
Functional Programming in JavaScript by Mantyla Dan(3723)
Svelte with Test-Driven Development by Daniel Irvine(2914)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2839)
WordPress Plugin Development Cookbook by Yannick Lefebvre(2603)
Architecting Modern Java EE Applications: Designing lightweight, business-oriented enterprise applications in the age of cloud, containers, and Java EE 8 by Daschner Sebastian(2559)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(2530)
Test-Driven Development with PHP 8 by Rainier Sarabia(2513)
React Native - Building Mobile Apps with JavaScript by Novick Vladimir(2340)