您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

settings.ts 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import {
  21. Setting,
  22. SettingCategoryDefinition,
  23. SettingType,
  24. SettingValue,
  25. SettingWithCategory
  26. } from '../../types/settings';
  27. export function mockDefinition(
  28. overrides: Partial<SettingCategoryDefinition> = {}
  29. ): SettingCategoryDefinition {
  30. return {
  31. key: 'foo',
  32. category: 'foo category',
  33. fields: [],
  34. options: [],
  35. subCategory: 'foo subCat',
  36. ...overrides
  37. };
  38. }
  39. export function mockSetting(overrides: Partial<Setting> = {}): Setting {
  40. return {
  41. key: 'foo',
  42. value: '42',
  43. hasValue: true,
  44. inherited: true,
  45. definition: {
  46. key: 'foo',
  47. name: 'Foo setting',
  48. description: 'When Foo then Bar',
  49. type: SettingType.INTEGER,
  50. options: []
  51. },
  52. ...overrides
  53. };
  54. }
  55. export function mockSettingValue(overrides: Partial<SettingValue> = {}) {
  56. return {
  57. key: 'test',
  58. ...overrides
  59. };
  60. }
  61. export function mockSettingWithCategory(
  62. overrides: Partial<SettingWithCategory> = {}
  63. ): SettingWithCategory {
  64. return {
  65. key: 'foo',
  66. value: '42',
  67. hasValue: true,
  68. inherited: true,
  69. definition: {
  70. key: 'foo',
  71. name: 'Foo setting',
  72. description: 'When Foo then Bar',
  73. type: SettingType.INTEGER,
  74. options: [],
  75. category: 'general',
  76. fields: [],
  77. subCategory: 'email'
  78. },
  79. ...overrides
  80. };
  81. }