Пример #1
0
    it('should apply options', () => {
      let appliedOptions = getRepository().applyOptions(getRepository().getQueryBuilder(), {
        select: 'name',
      });

      assert.notDeepEqual(appliedOptions, getRepository().getQueryBuilder());
    });
Пример #2
0
 it('should remove the item from the array', () => {
   let removedValue = dummy.values[1];
   let lastValue = dummy.values[2];
   dummy.remove(removedValue);
   assert.lengthOf(dummy.values, 2, 'dummy.values should now be 2 items');
   assert.notDeepEqual(dummy.values[1], removedValue, 'value[1] should now be a different value after remove');
   assert.deepEqual(dummy.values[1], lastValue, 'value[1] should now be equal to the last value');
 });
Пример #3
0
  it('should shuffle an array', () => {
    const arr = [1, 2, 3, 4, 5, 6];
    let arrCopy = [...arr];

    shuffleArray(arrCopy);

    assert.notDeepEqual(arr, arrCopy);
    assert.deepEqual(arr, arrCopy.sort());
  });
Пример #4
0
			it("returns proper result when async",  () => {
				const promise = testInstance.testAsyncMehtod(expectedResult);

				assert.notDeepEqual(promise.then, undefined);

				return promise.then((actualResult: any) => {
					assert.deepEqual(actualResult, expectedResult);
				});
			});
		it("should return correct value from json file if found in client json before common json", () => {
			const commonJsonContents = {
				KEY: "Value"
			},
				clientJsonContents = {
					KEY: "Overriden value"
				},
				pathToDefaultMessageJson = join(__dirname, "..", "..", "resources", "messages", "errorMessages.json"),
				injector = createTestInjector({});

			injector.register("fs", {
				exists: (path: string): boolean => true,
				readJson: (filename: string, encoding?: string): any => filename === pathToDefaultMessageJson ? commonJsonContents : clientJsonContents
			});
			service = injector.resolve("$messagesService");
			service.pathsToMessageJsonFiles = ["clientJsonFile.json"];

			assert.notDeepEqual(commonJsonContents.KEY, service.getMessage("KEY"), "Messages service should return correct value from json file when value is overriden by client.");
			assert.deepEqual(clientJsonContents.KEY, service.getMessage("KEY"), "Messages service should return correct value from json file when value is overriden by client.");
		});
Пример #6
0
 it('should successfully override nested enum config without changing the default', () => {
   assert.deepEqual(extendedOpt.enum.binProps.maxbins, [100,200]);
   assert.notDeepEqual(extendedOpt.enum.binProps.maxbins, DEFAULT_QUERY_CONFIG.enum.binProps.maxbins);
 });
Пример #7
0
 it('should successfully override top-level enum config without changing the default', () => {
   assert.deepEqual(extendedOpt.enum.mark, ['point']);
   assert.notDeepEqual(extendedOpt.enum.mark, DEFAULT_QUERY_CONFIG.enum.mark);
 });