Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. let lib = require('../src/lib')
  18. describe('lib end-to-end', function () {
  19. beforeEach(function () {
  20. })
  21. afterEach(function () {
  22. })
  23. describe('when parsing env variables', function () {
  24. it('should return empty map on null value', function () {
  25. expect(lib._parseEnvironmentVariables(null)).toEqual({})
  26. })
  27. it('should return empty map on undefined value', function () {
  28. expect(lib._parseEnvironmentVariables(undefined)).toEqual({})
  29. })
  30. describe('without simctl fix', function () {
  31. it('should return valid map for valid env variable', function () {
  32. expect(lib._parseEnvironmentVariables(['KEY=VALUE'], false)).toEqual({ 'KEY': 'VALUE' })
  33. })
  34. })
  35. describe('with simctl fix', function () {
  36. it('should add SIMCTL_CHILD_ prefix to all keys', function () {
  37. expect(lib._parseEnvironmentVariables(['KEY=VALUE', 'KEY2=VALUE2'], true))
  38. .toEqual(
  39. {
  40. 'SIMCTL_CHILD_KEY': 'VALUE',
  41. 'SIMCTL_CHILD_KEY2': 'VALUE2'
  42. }
  43. )
  44. })
  45. })
  46. })
  47. it('init should not process.exit when called as a lib', function () {
  48. let code = lib.init()
  49. expect(!isNaN(code)).toBe(true)
  50. })
  51. })