converter.test.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var runBenchmarks = require('../support/benchmark-runner');
  2. var Converter = require('../../index').query.converter;
  3. // ╔╗ ╔═╗╔╗╔╔═╗╦ ╦╔╦╗╔═╗╦═╗╦╔═╔═╗
  4. // ╠╩╗║╣ ║║║║ ╠═╣║║║╠═╣╠╦╝╠╩╗╚═╗
  5. // ╚═╝╚═╝╝╚╝╚═╝╩ ╩╩ ╩╩ ╩╩╚═╩ ╩╚═╝
  6. describe('Benchmark :: Converter', function() {
  7. // Set "timeout" and "slow" thresholds incredibly high
  8. // to avoid running into issues.
  9. this.slow(240000);
  10. this.timeout(240000);
  11. it('should be performant enough', function() {
  12. runBenchmarks('Converter()', [
  13. function buildSelectStatement() {
  14. Converter({
  15. model: 'user',
  16. method: 'find',
  17. criteria: {
  18. where: {
  19. firstName: 'Test',
  20. lastName: 'User'
  21. }
  22. }
  23. });
  24. },
  25. function buildInsertStatement() {
  26. Converter({
  27. model: 'user',
  28. method: 'create',
  29. values: {
  30. firstName: 'foo'
  31. }
  32. });
  33. },
  34. function buildUpdateStatement() {
  35. Converter({
  36. model: 'user',
  37. method: 'update',
  38. criteria: {
  39. where: {
  40. firstName: 'Test',
  41. lastName: 'User'
  42. }
  43. },
  44. values: {
  45. firstName: 'foo'
  46. }
  47. });
  48. },
  49. function buildDeleteStatement() {
  50. Converter({
  51. model: 'user',
  52. method: 'delete',
  53. criteria: {
  54. where: {
  55. firstName: 'Test',
  56. lastName: 'User'
  57. }
  58. }
  59. });
  60. }
  61. ]);
  62. });
  63. });