示例#1
0
文件: joi.js 项目: gatsbyjs/gatsby
  it(`allows assetPrefix to be a URL with nested paths`, () => {
    const config = {
      assetPrefix: `https://cdn.example.com/some/nested/path`,
    }

    expect(gatsbyConfigSchema.validate(config)).resolves.toEqual(config)
  })
示例#2
0
文件: joi.js 项目: gatsbyjs/gatsby
  it(`allows assetPrefix to be full URL`, () => {
    const config = {
      assetPrefix: `https://cdn.example.com`,
    }

    expect(gatsbyConfigSchema.validate(config)).resolves.toEqual(config)
  })
示例#3
0
文件: joi.js 项目: gatsbyjs/gatsby
  it(`allows relative paths for url fields`, () => {
    const config = {
      pathPrefix: `/blog`,
      assetPrefix: `https://cdn.example.com`,
    }

    expect(gatsbyConfigSchema.validate(config)).resolves.toEqual(config)
  })
示例#4
0
文件: joi.js 项目: gatsbyjs/gatsby
  it(`does not allow pathPrefix to be full URL`, () => {
    const config = {
      pathPrefix: `https://google.com`,
    }

    expect(
      gatsbyConfigSchema.validate(config)
    ).rejects.toThrowErrorMatchingSnapshot()
  })
示例#5
0
文件: joi.js 项目: gatsbyjs/gatsby
  it(`throws when relative path used for both assetPrefix and pathPrefix`, () => {
    const config = {
      assetPrefix: `/assets`,
      pathPrefix: `/blog`,
    }

    expect(
      gatsbyConfigSchema.validate(config)
    ).rejects.toThrowErrorMatchingSnapshot()
  })
示例#6
0
文件: joi.js 项目: gatsbyjs/gatsby
  it(`strips trailing slashes from url fields`, () => {
    const config = {
      pathPrefix: `/blog///`,
      assetPrefix: `https://cdn.example.com/`,
    }

    expect(gatsbyConfigSchema.validate(config)).resolves.toEqual({
      pathPrefix: `/blog`,
      assetPrefix: `https://cdn.example.com`,
    })
  })