const assert = require('assert') const theme = require('./theme') const customized = theme.resolveShopTheme({ themePrimaryColor: '#8b4f65', themeSecondaryColor: '#f2c9d4', themeAccentColor: '#b86f84', themePageBgColor: '#fff8fa', themeCardBgColor: '#ffffff', themeBackgroundImageFileId: 'bg-file' }) assert.strictEqual(customized.primaryColor, '#8B4F65') assert.strictEqual(customized.secondaryColor, '#F2C9D4') assert.strictEqual(customized.accentColor, '#B86F84') assert.strictEqual(customized.pageBgColor, '#FFF8FA') assert.strictEqual(customized.cardBgColor, '#FFFFFF') assert.strictEqual(customized.backgroundImageFileId, 'bg-file') assert.ok(customized.styleVars.includes('--theme-primary: #8B4F65;')) assert.ok(customized.styleVars.includes('--theme-gradient: linear-gradient(135deg, #8B4F65 0%, #F2C9D4 100%);')) const themedPageData = theme.pageThemeData(customized, 'https://static.example.test/bg.jpg') assert.ok(themedPageData.themeVars.includes('background-image: url("https://static.example.test/bg.jpg");')) assert.strictEqual(themedPageData.theme.backgroundImageUrl, 'https://static.example.test/bg.jpg') const fallback = theme.resolveShopTheme({ themePrimaryColor: '#fff', themeSecondaryColor: 'blue' }) assert.strictEqual(fallback.primaryColor, theme.DEFAULT_SHOP_THEME.primaryColor) assert.strictEqual(fallback.secondaryColor, theme.DEFAULT_SHOP_THEME.secondaryColor) assert.ok(fallback.styleVars.includes('--theme-page-bg:'))