How to use the @stoplight/prism-core/src/__tests__/utils.assertSome function in @stoplight/prism-core

To help you get started, we’ve selected a few @stoplight/prism-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stoplightio / prism / packages / http / src / mocker / generator / __tests__ / HttpParamGenerator.spec.ts View on Github external
it('uses static example', () => {
        assertSome(generate({ examples: [{ key: 'foo', value: 'test' }] }), v =>
          expect(v).toEqual('test')
        );
      });
    });
github stoplightio / prism / packages / http / src / mocker / negotiator / __tests__ / InternalHelpers.unit.ts View on Github external
it('should respect the q parameter', () => {
        const possibleResponse = findBestHttpContentByMediaType(avaiableResponses, [
          'application/json;q=0.8',
          'application/xml;q=1',
        ]);

        assertSome(possibleResponse, response => expect(response).toHaveProperty('mediaType', 'application/xml'));
      });
    });
github stoplightio / prism / packages / http / src / validator / validators / __tests__ / utils.spec.ts View on Github external
it('will return error for convertible values', () => {
      assertSome(
        validateAgainstSchema({ test: 10 }, { type: 'object', properties: { test: { type: 'string' } } }, false),
        error => expect(error).toContainEqual(expect.objectContaining({ message: 'should be string' }))
      );
    });
  });
github stoplightio / prism / packages / http / src / validator / utils / __tests__ / spec.spec.ts View on Github external
it('returns default response', () => {
      assertSome(
        findOperationResponse(
          [
            { code: '2XX', contents: [], headers: [] },
            { code: 'default', contents: [], headers: [] },
            { code: '1XX', contents: [], headers: [] },
          ],
          422,
        ),
        value => expect(value).toEqual({ code: 'default', contents: [], headers: [] }),
      );
    });
  });