Commit Graph

2297 Commits

Author SHA1 Message Date
Christopher Allford 85833f137c Fixed a bug that would cause APIService failures to throw unhandled exceptions when creating 2020-07-01 22:08:18 -07:00
Christopher Allford c3de8f0d12 Adjusted the structure of the factory package for easier consumption 2020-07-01 22:07:27 -07:00
Christopher Allford 0785e6caa7 Merge branch 'master' into package/e2e-factories/product 2020-07-01 14:11:25 -07:00
Christopher Allford 68daac3a94 Added a utility for initializing all of the APIAdapters with a service 2020-07-01 13:58:12 -07:00
Christopher Allford b4c1f3ca8f Fixed the POST, PUT, and PATCH Axios service actions 2020-07-01 12:31:20 -07:00
Christopher Allford bc3e1b4555 Replaced the exported variables with functions to populate the registry 2020-07-01 12:08:08 -07:00
Christopher Allford e6e764320b Added a registry to hold all of the factories and adapters 2020-07-01 11:07:57 -07:00
Christopher Allford 627bd5a99a Simplified the package directory structure 2020-06-30 21:37:17 -07:00
Christopher Allford c23f52aedf Created a base ModelFactory for all factories to extend 2020-06-30 19:00:42 -07:00
Christopher Allford 3e2e03d48a Fixed the URL being passed to the OAuth package 2020-06-30 16:01:47 -07:00
Christopher Allford 603a5e7812 Changed the structure of error responses
In practice having the response class contained within the error feels a little backwards. We can instead have a structured APIError model that is contained in the APIResponse and have a consistent response format to consume.
2020-06-30 16:01:12 -07:00
Christopher Allford 7500cc004d Added a skeleton product factory for testing 2020-06-30 13:05:25 -07:00
Christopher Allford 4aa9360ba7 Added an adapter to support creating models via the API 2020-06-30 12:50:15 -07:00
Christopher Allford ddbbbbc078 Adjusted the TypeScript configuration to use the --build flag 2020-06-24 16:08:28 -07:00
Christopher Allford 6ad8b57f2e Added formatting requirements to the code style 2020-06-24 14:47:46 -07:00
Christopher Allford 4e02ce7afd Moved the Axios response/error transformations into an interceptor 2020-06-24 11:35:04 -07:00
Christopher Allford 9908a84d0e Added a service for interacting with the WordPress API
We've hid the use of Axios behind a service so that we're able to easily mock it out in factories as well as handle the creation and configuration of the client. This will make it easier on consumers in that they won't have to worry about things like authentication when using the API.
2020-06-23 13:15:26 -07:00
Christopher Allford 031bb6593f Fixed the usage of baseURL with the APIAuthInterceptor 2020-06-23 11:53:00 -07:00
Christopher Allford 323d06744c Adjusted the APIAuthInterceptor to be more explicitly Axios-specific 2020-06-22 12:10:45 -07:00
Ron Rennick 59f2bdbe46 add template cache unit test 2020-06-22 16:05:29 -03:00
Ron Rennick ee151bbd95 Merge branch 'master' into add/npm-publish 2020-06-22 13:46:54 -03:00
Christopher Allford dd74c3db45 Removed build artifact 2020-06-20 18:46:59 -07:00
Christopher Allford 2a3b1b3780 Adjusted the package to better support NPM distribution 2020-06-20 18:25:19 -07:00
Christopher Allford 9f1decd4c6 Added an interceptor to handle WooCommerce API authentication 2020-06-19 12:08:48 -07:00
Christopher Allford 5e15271f95 Excluded test files from the TypeScript build 2020-06-18 09:43:11 -07:00
Christopher Allford 1418b68910 Initial configuration for e2e-factories package 2020-06-17 15:51:28 -07:00
Julia Amosova 281057eee8 Adjust various conditions of the OBW e2e test to make it pass 2020-06-17 17:20:12 -04:00
Ron Rennick 239476ddc5 create ready page after initialization script 2020-06-16 12:29:43 -03:00
Peter Fabian 418d95298a Merge branch 'master' into update/wc-admin-1.3.0-beta-1
# Conflicts:
#	composer.lock
2020-06-16 14:58:43 +02:00
Peter Fabian bb2cf2e8dc Removed deprecated method call. 2020-06-16 13:18:05 +02:00
Peter Fabian c35c4f1f08
Merge pull request #26395 from woocommerce/revert-26226-revert-25708-update/reserve-stock-for-checkout
Introduce a `reserved stock` class and database table to prevent race conditions during checkout
2020-06-16 11:38:10 +02:00
Vedanshu Jain 60ffc7ab99
Merge pull request #26583 from woocommerce/fix/26582
Fix regression caused by merging #25092 conflicting with #24828
2020-06-12 15:13:21 +05:30
Peter Fabian 296112cbea
Merge pull request #26237 from woocommerce/fix/24000
Fix adding product variant to cart using `add-to-cart` parameter (#24000)
2020-06-11 13:13:12 +02:00
Peter Fabian 439562e854
Merge pull request #23971 from woocommerce/refactor/23783
Better template caching for container environments
2020-06-11 10:13:46 +02:00
Vedanshu Jain b45373fe0c Revert "Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout"" 2020-06-05 15:18:01 +05:30
Vedanshu Jain 6564847802
Merge pull request #26454 from woocommerce/enhancement/verify-db
Add `verify_base_db` method to check if all base tables are present.
2020-06-05 15:15:39 +05:30
Ron Rennick 0265e027ef
Merge pull request #26637 from woocommerce/fix/wc_timezone_string
use wp_timezone_string when available
2020-06-03 15:41:47 -03:00
Claudio Sanches 4922c34180
Merge pull request #26136 from woocommerce/feature/code-hacker-for-unit-tests
Code hacker for unit tests
2020-06-03 08:41:28 -03:00
Nestor Soriano 32dac2486f Update autoload-dev in composer.json to add tests/tools directory
The mapping of the "Automattic\WooCommerce\Testing\Tools\" namespace
to the "tests/tools" directory is moved from manual registration
inside the tests bootstrap constructor to a declaration inside the
autload-dev section in composer.json.
2020-06-03 09:28:54 +02:00
Nestor Soriano bfda3f9938 Code hacker resdesign for single-load of code files.
The code hacker as originally designed, as a mechanism that allowed
to enable hacks at the individual test level, is flawed because it
assumes that code files are loaded before each test, but actually
the PHP engine loads code files only once.

Therefore this commit redesigns it so that the two existing main hacks,
the functions mocker and the static methods hacker, are applied
to all the relevant functions and classes at bootstrap time, and
mocks for each individual function/method can be registered at the
beginning of each test. See README for the full details.
2020-06-02 19:06:53 +02:00
Claudio Sanches 6afbed0c14 Fixed coding standards 2020-06-01 23:55:17 -03:00
Ron Rennick 1215844b05 update timezone unit tests to support WP 5.3/5.4 2020-05-29 08:29:35 -03:00
Ron Rennick 7fbe912e19 use wp_timezone_string when available 2020-05-29 07:54:43 -03:00
Peter Fabian 2394da73b4 Merge branch 'master' into refactor/23783 2020-05-28 11:19:03 +02:00
Peter Fabian 30fe1cde72 Moved unit tests to the new location. 2020-05-28 11:18:47 +02:00
vedanshujain bbb7600f87 Add unit test for calculation based on rounding pref 2020-05-27 23:55:46 +05:30
vedanshujain d904db815d Disable flaky test which was causing many calculation tests to fail. 2020-05-27 23:53:20 +05:30
vedanshujain af942a131a Add test to ensure that verify_base_table also creates table if needed. 2020-05-26 23:46:58 +05:30
vedanshujain 57d336433a Fix regression caused by merging #25092 conflicting with #24828 2020-05-22 22:08:42 +05:30
vedanshujain 418741a0b2 Add unit test for verify_base_tables function 2020-05-22 18:32:04 +05:30