How to use the sazerac.given function in sazerac

To help you get started, we’ve selected a few sazerac 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 badges / shields / lib / logos.spec.js View on Github external
test(isDataUrl, () => {
    //valid input
    given('data:image/svg+xml;base64,PHN2ZyB4bWxu').expect(true)

    // invalid inputs
    forCases([given('data:foobar'), given('foobar')]).expect(false)

    // attempted XSS attack
    given(
      'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg=="/>'
    ).expect(false)
  })
github badges / shields / core / base-service / coalesce.spec.js View on Github external
test(coalesce, function() {
    given().expect(undefined)
    given(null, []).expect([])
    given(null, [], {}).expect([])
    given(null, undefined, 0, {}).expect(0)

    const a = null,
      c = 0,
      d = 1
    let b
    given(a, b, c, d).expect(0)
  })
})
github badges / shields / core / base-service / coalesce.spec.js View on Github external
test(coalesce, function() {
    given().expect(undefined)
    given(null, []).expect([])
    given(null, [], {}).expect([])
    given(null, undefined, 0, {}).expect(0)

    const a = null,
      c = 0,
      d = 1
    let b
    given(a, b, c, d).expect(0)
  })
})
github badges / shields / services / text-formatters.spec.js View on Github external
test(formatRelativeDate, () => {
      given(new Date(2018, 9, 31).getTime() / 1000)
        .describe('when given the end of october')
        .expect('in 2 days')
    })
github badges / shields / services / text-formatters.spec.js View on Github external
test(formatDate, () => {
      given(new Date(2017, 0, 1).getTime())
        .describe('when given the beginning of this year')
        .expect('january')
    })
  })
github badges / shields / services / color-formatters.spec.js View on Github external
test(age, () => {
    given(Date.now())
      .describe('when given the current timestamp')
      .expect('brightgreen')
    given(new Date())
      .describe('when given the current Date')
      .expect('brightgreen')
    given(new Date(2001, 1, 1))
      .describe('when given a Date many years ago')
      .expect('red')
    given(monthsAgo(2))
      .describe('when given a Date two months ago')
      .expect('yellowgreen')
    given(monthsAgo(15))
      .describe('when given a Date 15 months ago')
      .expect('orange')
  })
github badges / shields / lib / logos.spec.js View on Github external
test(makeLogo, () => {
    forCases([
      given('npm', { logo: 'image/svg+xml;base64,PHN2ZyB4bWxu' }),
      given('npm', { logo: 'data:image/svg+xml;base64,PHN2ZyB4bWxu' }),
      given('npm', { logo: 'data:image/svg xml;base64,PHN2ZyB4bWxu' }),
      given('npm', { logo: 'data:image/svg+xml;base64,PHN2ZyB\n4bWxu' }),
    ]).expect('data:image/svg+xml;base64,PHN2ZyB4bWxu')
    forCases([given('npm', { logo: '' }), given(undefined, {})]).expect(
      undefined
    )
    given('npm', {}).expect(
      'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZD0iTTAgMGg0MHY0MEgwVjB6IiBmaWxsPSIjY2IwMDAwIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTcgN2gyNnYyNmgtN1YxNGgtNnYxOUg3eiIvPjwvc3ZnPgo='
    )
  })
})
github badges / shields / gh-badges / lib / color.spec.js View on Github external
test(isHexColor, () => {
  forCases([given('f00bae'), given('4c1'), given('ABC123')]).expect(true)
  forCases([
    given('f00bar'),
    given(''),
    given(undefined),
    given(null),
    given(true),
    given([]),
    given({}),
    given(() => {}),
  ]).expect(false)
})
github badges / shields / gh-badges / lib / make-badge.spec.js View on Github external
test(testColor, () => {
      forCases([
        given('#4c1', 'color'),
        given('#4c1', 'colorB'),
        given('#4c1', 'colorscheme'),
      ]).expect('#4c1')
    })
  })
github badges / shields / gh-badges / lib / make-badge.spec.js View on Github external
test(testColor, () => {
      forCases([
        given('#4c1', 'color'),
        given('#4c1', 'colorB'),
        given('#4c1', 'colorscheme'),
      ]).expect('#4c1')
    })
  })

sazerac

<p align="center"> <a href="http://sazerac.js.org" target="_blank"><img width="50" src="http://sazerac.js.org/images/logo.svg"></a> </p>

MIT
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis

Popular sazerac functions