import { expect } from '../../../test-utils'; import { PlatformError } from '../platform-error'; describe('PlatformError', function () { const makeError = (message: string, type = 'invalid_request_error', status = 400) => new PlatformError({ error: { message, type, more_info: '' } }, status); it('suggests running rp push when there is no definition in review', function () { const error = makeError('Product module has no definition in review'); expect(error.message).to.contain('Tip: There is no draft definition to publish.'); expect(error.message).to.contain('rp push'); }); it('suggests running rp push when there is no draft definition', function () { const error = makeError('Product module has no draft definition to publish.'); expect(error.message).to.contain('rp push'); }); it('gives no publish tip for unrelated 400s', function () { const error = makeError('Some other problem'); expect(error.message).to.not.contain('rp push'); expect(error.message).to.contain('Status: 400'); expect(error.message).to.contain('Some other problem'); }); });