How to use the unexpected function in unexpected

To help you get started, we’ve selected a few unexpected 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 FreeFeed / freefeed-server / test / functional / postsV2.js View on Github external
const expectFolding = async (nComments, expComments, expOmitted, allComments = false) => {
          for (let n = 0; n < nComments; n++) {
            await createCommentAsync(luna, lunaPost.id, `Comment ${n + 1}`);  // eslint-disable-line no-await-in-loop
          }

          const post = await fetchPost(lunaPost.id, null, { allComments });
          expect(post.posts.comments, 'to have length', expComments);
          expect(post.posts.omittedComments, 'to equal', expOmitted);
        };
github FreeFeed / freefeed-server / test / functional / common-routing.js View on Github external
it(`should publish the X-Freefeed-Server (server version) and Date response header`, async () => {
    const resp = await fetch(`${app.context.config.host}/v2/users/whoami`);
    expect(resp.status, 'to be', 401);
    expect(resp.headers.get('X-Freefeed-Server'), 'to be', serverVersion);
    expect(resp.headers.get('Access-Control-Expose-Headers'), 'to contain', 'X-Freefeed-Server');
    expect(resp.headers.get('Access-Control-Expose-Headers'), 'to contain', 'Date');
  });
github FreeFeed / freefeed-server / test / functional / timelines-rss.js View on Github external
it('should not return metatag for unexisting user', async () => {
      const meta = await fetchMetatags('evita');
      expect(meta, 'not to contain', `
github builify / tt-stylesheet / test / index.spec.js View on Github external
it('does not pass other types', function () {
        expect(Stylesheet._isArray(new Date()), 'to be false');
        expect(Stylesheet._isArray(/test/i), 'to be false');
        expect(Stylesheet._isArray(function () {}), 'to be false');
        expect(Stylesheet._isArray({}), 'to be false');
        expect(Stylesheet._isArray(''), 'to be false');
        expect(Stylesheet._isArray(123), 'to be false');
        expect(Stylesheet._isArray(true), 'to be false');
        expect(Stylesheet._isArray(undefined), 'to be false');
        expect(Stylesheet._isArray(null), 'to be false');
      });
    });
github builify / tt-stylesheet / test / index.spec.js View on Github external
it('does not pass other types', function () {
        expect(Stylesheet._isObject(new Date()), 'to be false');
        expect(Stylesheet._isObject(/test/i), 'to be false');
        expect(Stylesheet._isObject(function () {}), 'to be false');
        expect(Stylesheet._isObject([]), 'to be false');
        expect(Stylesheet._isObject(''), 'to be false');
        expect(Stylesheet._isObject(123), 'to be false');
        expect(Stylesheet._isObject(true), 'to be false');
        expect(Stylesheet._isObject(undefined), 'to be false');
        expect(Stylesheet._isObject(null), 'to be false');
      });
    });
github FreeFeed / freefeed-server / test / functional / realtime2.js View on Github external
it(`should deliver 'post:update' event with isSaved field only to Luna when Luna updates post`, async () => {
          const lunaEvent = lunaSession.receive('post:update');
          const marsEvent = marsSession.receive('post:update');
          const anonEvent = anonSession.receive('post:update');
          luna.post = post;
          await Promise.all([
            funcTestHelper.updatePostAsync(luna, { body: 'Updated post' }),
            lunaEvent, marsEvent, anonEvent,
          ]);
          expect(lunaEvent, 'to be fulfilled with value satisfying', { posts: { isSaved: true } });
          expect(marsEvent, 'to be fulfilled with value satisfying', { posts: expect.it('to not have key', 'isSaved') });
          expect(anonEvent, 'to be fulfilled with value satisfying', { posts: expect.it('to not have key', 'isSaved') });
        });
      });
github FreeFeed / freefeed-server / test / functional / archives.js View on Github external
it('should not allow anonymous to restore activities', async () => {
      const resp = await putActivities(app);
      expect(resp.status, 'to equal', 401);
    });
github FreeFeed / freefeed-server / test / functional / users.js View on Github external
const getSubscribers = async (viewerCtx = null) => {
      const headers = {};

      if (viewerCtx !== null) {
        headers['X-Authentication-Token'] = viewerCtx.authToken;
      }

      const resp = await fetch(`${app.context.config.host}/v1/users/${user.username}/subscribers`, { headers });
      const json = await resp.json();

      if (!resp.ok) {
        const message = json.err ? `${resp.status} ${resp.statusText}: ${json.err}` : `${resp.status} ${resp.statusText}`;
        throw new Error(message);
      }

      expect(json, 'to exhaustively satisfy', schema.userSubscribersResponse);
      return json;
    };
github FreeFeed / freefeed-server / test / functional / postsV2.js View on Github external
const expectFolding = async (nLikes, expLikes, expOmitted, allLikes = false) => {
          await Promise.all(users.slice(0, nLikes).map((u) => like(lunaPost.id, u.authToken)));
          const post = await fetchPost(lunaPost.id, null, { allLikes });
          expect(post.posts.likes, 'to have length', expLikes);
          expect(post.posts.omittedLikes, 'to equal', expOmitted);
        };
github builify / tt-stylesheet / Test / index.spec.js View on Github external
it('adds numbers', function () {
      expect(add(1, 3), 'to be', 4);
    });
  });

unexpected

Extensible BDD assertion toolkit

MIT
Latest version published 9 months ago

Package Health Score

67 / 100
Full package analysis